Service-oriented system optimization using edge relocation

ABSTRACT

Methods, systems, and computer-readable media for implementing service-oriented system optimization using edge relocation are disclosed. An optimized configuration is determined for a service-oriented system based on trace data for a plurality of service interactions between services. One or more of the services are relocated to one or more edge hosts based on the optimized configuration. The relocation improves a total performance metric in at least a portion of the service-oriented system.

BACKGROUND

Many companies and other organizations operate computer networks thatinterconnect numerous computing systems to support their operations,such as with the computing systems being co-located (e.g., as part of alocal network) or instead located in multiple distinct geographicallocations (e.g., connected via one or more private or publicintermediate networks). For example, distributed systems housingsignificant numbers of interconnected computing systems have becomecommonplace. Such distributed systems may provide back-end services toweb servers that interact with clients. Such distributed systems mayalso include data centers that are operated by entities to providecomputing resources to customers. Some data center operators providenetwork access, power, and secure installation facilities for hardwareowned by various customers, while other data center operators provide“full service” facilities that also include hardware resources madeavailable for use by their customers. However, as the scale and scope ofdistributed systems have increased, the tasks of provisioning,administering, and managing the resources have become increasinglycomplicated.

Web servers backed by distributed systems may provide marketplaces thatoffer goods and/or services for sale to consumers. For instance,consumers may visit a merchant's website to view and/or purchase goodsand services offered for sale by the merchant (and/or third partymerchants). Some network-based marketplaces (e.g., Internet-basedmarketplaces) include large electronic catalogues of items offered forsale. For each item offered for sale, such electronic cataloguestypically include at least one product detail page (e.g., a web page)that specifies various information about the item, such as a descriptionof the item, one or more pictures of the item, as well as specifications(e.g., weight, dimensions, capabilities) of the item. In various cases,such network-based marketplaces may rely on a service-orientedarchitecture to implement various business processes and other tasks.The service-oriented architecture may be implemented using a distributedsystem that includes many different computing resources and manydifferent services that interact with one another, e.g., to produce aproduct detail page for consumption by a client of a web server.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 illustrates an example system environment for service-orientedsystem optimization using trace data, according to some embodiments.

FIG. 2A illustrates aspects of an example system environment forservice-oriented system optimization using trace data, including servicerelocation from host to host, according to some embodiments.

FIG. 2B illustrates aspects of an example system environment forservice-oriented system optimization using trace data, includingmodification of the number of service instances, according to someembodiments.

FIG. 3A illustrates aspects of an example system environment forservice-oriented system optimization using trace data, including servicerelocation to a common host, according to some embodiments.

FIG. 3B illustrates aspects of an example system environment forservice-oriented system optimization using trace data, including servicerelocation to a virtual machine on a common host, according to someembodiments.

FIG. 4 illustrates aspects of an example system environment forservice-oriented system optimization using trace data, including requestrouting, according to some embodiments.

FIG. 5 is a flowchart illustrating a method for service-oriented systemoptimization using trace data, according to some embodiments.

FIG. 6A illustrates an example system environment for service-orientedsystem optimization using partial service relocation, according to someembodiments.

FIG. 6B illustrates further aspects of an example system environment forservice-oriented system optimization using partial service relocation,according to some embodiments.

FIG. 6C illustrates further aspects of an example system environment forservice-oriented system optimization using partial service relocation,including the use of a router, according to some embodiments.

FIG. 6D illustrates further aspects of an example system environment forservice-oriented system optimization using partial service relocation,including the inlining of frequently used code, according to someembodiments.

FIG. 7 illustrates aspects of an example system environment forservice-oriented system optimization using partial service relocation,including partial service relocation from host to host, according tosome embodiments.

FIG. 8A illustrates aspects of an example system environment forservice-oriented system optimization using partial service relocation,including partial service relocation to a common host, according to someembodiments.

FIG. 8B illustrates aspects of an example system environment forservice-oriented system optimization using partial service relocation,including partial service relocation to a virtual machine on a commonhost, according to some embodiments.

FIG. 8C illustrates aspects of an example system environment forservice-oriented system optimization using partial service relocation,including partial service relocation to a common process on a commonhost, according to some embodiments.

FIG. 9 is a flowchart illustrating a method for service-oriented systemoptimization using partial service relocation, according to someembodiments.

FIG. 10 illustrates an example system environment for service-orientedsystem optimization using cross-service static analysis, according tosome embodiments.

FIG. 11A illustrates an example of service-oriented system optimizationusing cross-service static analysis, according to some embodiments.

FIG. 11B illustrates an example of service-oriented system optimizationusing cross-service static analysis, according to some embodiments.

FIG. 12A is a flowchart illustrating a method for service-orientedsystem optimization using cross-service static analysis, according tosome embodiments.

FIG. 12B is a flowchart illustrating a method for service-orientedsystem optimization using cross-service static analysis, includingcollocation of services, according to some embodiments.

FIG. 12C is a flowchart illustrating a method for service-orientedsystem optimization using cross-service static analysis, includinggeneration of optimized services, according to some embodiments.

FIG. 13 illustrates an example system environment for globaloptimization of a service-oriented system, according to someembodiments.

FIG. 14 illustrates further aspects of an example system environment forglobal optimization of a service-oriented system, according to someembodiments.

FIG. 15A illustrates an example of global optimization of aservice-oriented system, including cache optimization, according to someembodiments.

FIG. 15B illustrates an example of global optimization of aservice-oriented system, including logical cache optimization, accordingto some embodiments.

FIG. 15C illustrates an example of global optimization of aservice-oriented system, including distributed cache optimization,according to some embodiments.

FIG. 15D illustrates an example of global optimization of aservice-oriented system, including data location optimization, accordingto some embodiments.

FIG. 15E illustrates an example of global optimization of aservice-oriented system, including service location optimization fordata source access, according to some embodiments.

FIG. 15F illustrates an example of global optimization of aservice-oriented system, including optimization of responseprecomputation, according to some embodiments.

FIG. 16 is a flowchart illustrating a method for global optimization ofa service-oriented system, according to some embodiments.

FIG. 17A illustrates an example system environment for service-orientedsystem optimization using edge relocation, according to someembodiments.

FIG. 17B illustrates further aspects of an example system environmentfor service-oriented system optimization using edge relocation,according to some embodiments.

FIG. 18 is a flowchart illustrating a method for service-oriented systemoptimization using edge relocation, according to some embodiments.

FIG. 19A illustrates an example system environment for service-orientedsystem optimization using client device relocation, according to someembodiments.

FIG. 19B illustrates further aspects of an example system environmentfor service-oriented system optimization using client device relocation,according to some embodiments.

FIG. 20 is a flowchart illustrating a method for service-oriented systemoptimization using client device relocation, according to someembodiments.

FIG. 21 illustrates an example format of a request identifier, accordingto some embodiments.

FIG. 22 illustrates an example transaction flow for fulfilling a rootrequest, according to some embodiments.

FIG. 23 illustrates one example of a service of a service-orientedsystem, according to some embodiments.

FIG. 24 illustrates an example data flow diagram for the collection oflog data and generation of a call graph, according to some embodiments.

FIG. 25 illustrates an example visual representation of a call graph andrequest identifiers from which such call graph is generated, accordingto some embodiments.

FIG. 26 illustrates an example system configuration for tracking servicerequests, according to some embodiments.

FIG. 27 is a software architecture diagram illustrating thecontainerization of various types of program components, according tosome embodiments.

FIG. 28 illustrates an example of a computing device that may be used insome embodiments.

While embodiments are described herein by way of example for severalembodiments and illustrative drawings, those skilled in the art willrecognize that embodiments are not limited to the embodiments ordrawings described. It should be understood, that the drawings anddetailed description thereto are not intended to limit embodiments tothe particular form disclosed, but on the contrary, the intention is tocover all modifications, equivalents and alternatives falling within thespirit and scope as defined by the appended claims. The headings usedherein are for organizational purposes only and are not meant to be usedto limit the scope of the description or the claims. As used throughoutthis application, the word “may” is used in a permissive sense (i.e.,meaning “having the potential to”), rather than the mandatory sense(i.e., meaning “must”). Similarly, the words “include,” “including,” and“includes” mean “including, but not limited to.”

DETAILED DESCRIPTION OF EMBODIMENTS

Various embodiments of methods and systems for providingservice-oriented system optimization are described. Using the systemsand methods described herein, interactions between services (e.g.,service requests and service responses) in a distributed system may bemonitored by individual services. Based on the trace data generated bythe monitoring, one or more performance metrics for the serviceinteractions may be generated, and one or more call graphs capturingrelationships between the services may be generated. An optimizedconfiguration may be generated for the services. In one embodiment, theoptimized configuration may be generated based (at least in part) on theperformance metric(s). In one embodiment, the optimized configurationmay be generated based (at least in part) on the call graph(s). In oneembodiment, the optimized configuration may be generated based (at leastin part) on static analysis of the program code of one or more services,e.g., to detect dependencies between services. Services may be relocated(e.g., to different hosts) to implement the optimized configuration. Inone embodiment, a partial service may be generated to include frequentlyused program code from an original service, and the partial service maybe deployed in suitable locations based on the optimized configuration.In one embodiment, a service may be relocated to an edge host to reducelatency between the service-oriented system and client devices. In oneembodiment, a service may be relocated to a client device to reduce thelatency of client transactions. In general, global informationconcerning the service-oriented system may be used to optimize anysuitable characteristic of the system, e.g., by selecting optimizedconfiguration options. In this manner, the performance and/or cost ofthe service-oriented system may be optimized.

FIG. 1 illustrates an example system environment for service-orientedsystem optimization using trace data, according to some embodiments. Theexample system environment may include a service-oriented system 100 andan optimization system 150. The service-oriented system 100 mayimplement a service-oriented architecture and may include multipleservices 110A-110N configured to communicate with each other (e.g.,through message passing) to carry out various tasks, such as businessfunctions. Although two services 110A and 110N are illustrated forpurposes of example, it is contemplated that any suitable number ofservices may be used with the service-oriented system 100. The services110A-110N may represent different services (e.g., different sets ofprogram code) or different instances of the same service. The services110A-110N may be implemented using a plurality of hosts, any of whichmay be implemented by the example computing device 3000 illustrated inFIG. 28. The hosts may be located in any suitable number of data centersor geographical locations. In one embodiment, multiple services and/orinstances of the same service may be implemented using the same host. Itis contemplated that the service-oriented system 100 and/or optimizationsystem 150 may include additional components not shown, fewer componentsthan shown, or different combinations, configurations, or quantities ofthe components shown.

Each service 110A-110N may be configured to perform one or morefunctions upon receiving a suitable request. For example, a service maybe configured to retrieve input data from one or more storage locationsand/or from a service request, transform or otherwise process the data,and generate output data. In some cases, a first service may call asecond service, the second service may call a third service to satisfythe request from the first service, and so on. For example, to build aweb page dynamically, numerous services may be invoked in a hierarchicalmanner to build various components of the web page. In some embodiments,services may be loosely coupled in order to minimize (or in some caseseliminate) interdependencies among services. This modularity may enableservices to be reused in order to build various applications through aprocess referred to as orchestration. A service may include one or morecomponents that may also participate in the service-oriented system,e.g., by passing messages to other services or to other componentswithin the same service.

The service-oriented system 100 may be configured to process requestsfrom various internal or external systems, such as client computersystems or computer systems consuming networked-based services (e.g.,web services). For instance, an end-user operating a web browser on aclient computer system may submit a request for data (e.g., dataassociated with a product detail page, a shopping cart application, acheckout process, search queries, etc.). In another example, a computersystem may submit a request for a web service (e.g., a data storageservice, a data query, etc.). In general, services may be configured toperform any of a variety of business processes.

The services 110A-110N described herein may include but are not limitedto one or more of network-based services (e.g., a web service),applications, functions, objects, methods (e.g., objected-orientedmethods), subroutines, or any other set of computer-executableinstructions. In various embodiments, such services may communicatethrough any of a variety of communication protocols, including but notlimited to the Simple Object Access Protocol (SOAP). In variousembodiments, messages passed between services may include but are notlimited to Extensible Markup Language (XML) messages or messages of anyother markup language or format. In various embodiments, descriptions ofoperations offered by one or more of the services may include WebService Description Language (WSDL) documents, which may in some casesbe provided by a service broker accessible to the services andcomponents. References to services herein may include components withinservices.

In one embodiment, each of the services 110A-110N may be configured withone or more components for monitoring interactions between services. Forexample, service 110A may include an interaction monitoringfunctionality 120A, and service 110N may include an interactionmonitoring functionality 120N. The interaction monitoring functionality120A or 120N may monitor or track interactions between the correspondingservice 110A or 110N and other services (or components of services) inthe service-oriented system 100. The monitored interactions may includeservice requests 125A-125N (i.e., requests for services to beperformed), responses 126A-126N to requests, and other suitable events.

In one embodiment, the interaction monitoring functionality 120A or 120Nmay monitor service interactions such as service requests 125A or 125Nand service responses 126A or 126N in any suitable environment, such asa production environment and/or a test environment. The productionenvironment may be a “real-world” environment in which a set ofproduction services are invoked, either directly or indirectly, byinteractions with a real-world client, consumer, or customer, e.g., ofan online merchant or provider of web-based services. In one embodiment,the test environment may be an environment in which a set of testservices are invoked in order to test their functionality. The testenvironment may be isolated from real-world clients, consumers, orcustomers of an online merchant or provider of web-based services. Inone embodiment, the test environment may be implemented by configuringsuitable elements of computing hardware and software in a mannerdesigned to mimic the functionality of the production environment. Inone embodiment, the test environment may temporarily borrow resourcesfrom the production environment. In one embodiment, the test environmentmay be configured to shadow the production environment, such thatindividual test services represent shadow instances of correspondingproduction services. When the production environment is run in shadowmode, copies of requests generated by production services may beforwarded to shadow instances in the test environment to execute thesame transactions.

To monitor the service requests 125A-125N and responses 126A-126N,lightweight instrumentation may be added to services, including services110A-110N. The instrumentation (e.g., a reporting agent associated witheach service) may collect and report data associated with each inboundrequest, outbound request, or other service interaction (e.g., atimer-based interaction) processed by a service. Further aspects of theinteraction monitoring functionality 120A-120N are discussed below withrespect to FIG. 21 through FIG. 26.

Based on the interaction monitoring, a service may collect trace dataand send the trace data to the optimization system 150. For example,service 110A may collect and send trace data 130A, and service 110N maycollect and send trace data 130N. The trace data may describe aspects ofthe service interactions. In one embodiment, the trace data may begenerated in real-time or near real-time, e.g., as service requests andservice responses are received and/or processed by the services. Thetrace data may include data indicative of relationships betweenindividual services, such as an identification of the calling (i.e.,requesting) service and the called (i.e., requested) service for eachinteraction. The trace data may include metadata such as requestidentifiers that are usable to identify paths of service requests andresponses from service to service. Request identifiers are discussed ingreater detail below with respect to FIG. 21 through FIG. 26. The tracedata may also include data describing the performance of the serviceinteractions. For example, the trace data may include data indicative ofnetwork latency for a request or response, data indicative of networkthroughput for one or more interactions, data indicative of servicereliability or availability, data indicative of resource usage, etc. Thetrace data generated for multiple services and multiple serviceinteractions may be sent to the optimization system 150 for aggregationand analysis.

In one embodiment, the optimization system 150 may include a pluralityof components configured for analysis of the trace data 130A-130N andoptimization of the service-oriented system 100 based on the analysis.For example, the optimization system 150 may include a performanceanalysis functionality 160, a data flow analysis functionality 170, andan optimizer functionality 180. The optimization system 150 may includeone or more computing devices, any of which may be implemented by theexample computing device 3000 illustrated in FIG. 28. In variousembodiments, the functionality of the different services, components,and/or modules of the optimization system 150 may be provided by thesame computing device or by different computing devices. If any of thevarious components are implemented using different computing devices,then the respective computing devices may be communicatively coupled,e.g., via a network. Each one of the performance analysis functionality160, the data flow analysis functionality 170, and the optimizerfunctionality 180 may represent any combination of software and hardwareusable to perform their respective functions, as discussed as follows.

Using the performance analysis functionality 160, the optimizationsystem 150 may analyze the performance data generated by the interactionmonitoring functionality 120A-120N and received by the optimizationsystem 150 in the trace data 130A-130N. The performance analysisfunctionality 160 may determine one or more performance metrics 165based on the trace data 130A-130N. In one embodiment, the performancemetrics 165 may describe aspects of the performance of multipleinteractions, such as metrics representing aggregate performance,average performances, etc. In one embodiment, the performance metrics165 may describe aspects of the performance of individual interactions.For example, the optimization system 150 may calculate theclient-measured latency for an interaction based on the time at which arequest was sent by a service and also on the time at which a responseto the request was received by the service. The optimization system 150may also calculate the server-measured latency for an interaction basedon the time at which a request was received by a service and also on thetime at which a response to the request was sent by the service. Thenetwork transit time for the interaction may be calculated as thedifference between the client-measured latency and the server-measuredlatency. Accordingly, the performance metrics 165 may include individualtransit times for individual service calls and/or transit time metrics(e.g., mean, median, etc.) for multiple service calls. Network transittimes may be impacted by the number of network hops, the physicaldistance between hops, and the link quality between endpoints. In oneembodiment, the performance metrics 165 may describe aspects of thecosts of performing or maintaining various interactions, services,instances of services, and/or hosts. For example, the cost may includeelements of computing resource usage (e.g., processor usage, persistentstorage usage, memory usage, etc.), energy consumption, heat production,and/or any other suitable cost element(s).

The interaction monitoring functionality 120A-120N for the variousservices may collect data indicative of service interactions involved insatisfying a particular initial request, e.g., data indicative of aroute taken in satisfying a service request and/or a hierarchy of callpathways between services. The route may correspond to a set of callpaths between services. The call paths may represent inbound servicerequests and outbound service requests relative to a particular service.To process a given received request, one or more services may beinvoked. As used herein, an initial request may be referred to as the“root request.” In various embodiments, the root request may but neednot originate from a computer system outside of the service-orientedsystem 100. In many embodiments, a root request may be processed by aninitial service, which may then call one or more other services.Additionally, each of those services may also call one or more otherservices, and so on until the root request is completely fulfilled. Theparticular services called to fulfill a request may be represented as acall graph that specifies, for each particular service of multipleservices called to fulfill the same root request, the service thatcalled the particular service and any services called by the particularservice.

Using the data flow analysis functionality 170, the optimization system150 may analyze the trace data 130A-130N and generate one or more callgraphs 175 based on connectivity information within the trace data. Eachcall graph may represent the flow of requests from service to serviceand may identify service dependencies. Each call graph may include aplurality of nodes representing services and one or more edges (alsoreferred to as call paths) representing service interactions. Each ofthe call graphs 175 may include a hierarchical data structure thatinclude nodes representing the services and edges representing theinteractions. In some cases, a call graph may be a deep and broad treewith multiple branches each representing a series of related servicecalls. The data flow analysis functionality 170 may use any suitabledata and metadata to build each call graph, such as request identifiersand metadata associated with services and their interactions. Therequest identifiers and metadata are discussed below with respect toFIG. 21 through FIG. 26. In one embodiment, the data flow analysisfunctionality 170 may analyze the trace data 130A-130N and generatesuitable reports and/or visualizations (e.g., call graph visualizations)based on the trace data 130A-130N.

The generation of a particular call graph may be initiated based on anysuitable determination. In one embodiment, the call graph generation maybe initiated after a sufficient period of time has elapsed with nofurther service interactions made for any relevant service. In oneembodiment, heuristics or other suitable rule sets may be used todetermine a timeout for a lack of activity to satisfy a particular rootrequest. The timeout may vary based on the nature of the root request.For example, a root request to generate a web page using a hierarchy ofservices may be expected to be completed within seconds; accordingly,the call graph may be finalized within seconds or minutes.

Using the optimizer functionality 180, the optimization system 150 maydetermine an optimized configuration 185 for at least a portion of theone or more call graph(s). As used herein, the term “optimized”generally means “improved” rather than “optimal.” The optimizedconfiguration 185 for a set of services may represent an improvement onthe existing configuration of the set of services with respect to one ormore performance metrics (e.g., network latency or transit times,throughput, reliability or availability, cost, etc.) for at least aportion of the one or more call graphs. Accordingly, the optimizedconfiguration 185 may be determined based on the one or more performancemetrics 165 in order to optimize one or more call paths of the one ormore call graphs 175. In one embodiment, the optimized configuration 185may also be determined based on additional information that is notderived from trace data, such as an expense associated with each serviceinstance, service interaction, host, and/or unit of resourceconsumption. In one embodiment, the optimized configuration 185 may bedetermined such that it minimizes, maximizes, decreases, or increases atotal performance metric for one or more call paths. For example, theoptimized configuration 185 may minimize or reduce the network latencyfor one or more call paths, maximize or increase the throughput for oneor more call paths, maximize or increase the reliability or availabilityfor one or more call paths, or minimize or reduce the cost for one ormore call paths. The optimizer 180 may take into account the sensitivityof a particular call path to latency, e.g., whether improving thelatency of one event would improve the latency of another event in acall graph. Any suitable component(s) may be used to implement theoptimizer 180. For example, the optimizer 180 may be implemented using aconstrained optimization solver which is configured to minimize a costfunction or an energy function in the presence of one or moreconstraints or to maximize a reward function or a utility function inthe presence of one or more constraints. The optimizer 180 may generatean optimized configuration 185 by optimizing a user-defined function ofnetwork latency, throughput, reliability, cost, and/or any othersuitable term(s).

In one embodiment, data and/or metadata associated with a request orresponse may be compressed, encrypted, or serialized by a service.Similarly, data and/or metadata associated with a request or responsemay be decompressed, decrypted, or deserialized upon receipt by aservice. The cost or time associated with compression, decompression,encryption, decryption, serialization, and/or deserialization may betaken into account by the optimizer 180. Accordingly, performancemetrics associated with the costs of preparing a message for networktransport and processing such a received message (e.g., the costs ofcompression, decompression, encryption, decryption, serialization,and/or deserialization) may be collected as part of the trace data.Additionally, the optimizer 180 may take into account such performancedata as CPU (central processing unit) utilization for program code,memory utilization for program code, and any other suitable data. In oneembodiment, the optimization system 150 may collect performance datafrom sources other than the interaction monitoring components.

In one embodiment, all or nearly all of the service interactions (e.g.,the service requests 125A-125N and service responses 126A-126N) may bemonitored to generate trace data 130A-130N for use with the optimizationsystem 150. In one embodiment, however, only a subset of the serviceinteractions (e.g., service requests 125A-125N and service responses126A-126N) may be monitored to generate trace data 130A-130N for usewith the optimization system 150. Any suitable technique may be used toidentify which of the service interactions are collected and/or used asthe basis for the optimized configuration 185. For example,probabilistic sampling techniques may be used to initiate interactionmonitoring for a certain percentage (e.g., 1%) of all serviceinteractions.

As will be described in greater detail below, the location(s) of one ormore services may be modified based on the optimized configuration 185.In one embodiment, as illustrated in FIG. 2A, one or more services maybe moved to a different host. In one embodiment, as illustrated in FIG.2B, the number of service instances may be modified. In one embodiment,as illustrated in FIG. 3A, a service may be moved to the same host asanother service with which it shares a call path. In one embodiment, asillustrated in FIG. 3B, a service may be moved to the same virtualmachine on the same host as another service with which it shares a callpath. In this manner, the performance of the service-oriented system 100may be improved through the collection and analysis of the trace data130A-130N.

In one embodiment, the optimization system 150 may receive a continuousstream of trace data from the service-oriented system 100. Theoptimization system 150 may generate and/or modify the optimizedconfiguration 185 repeatedly and at appropriate intervals. Similarly,the placement of services may be modified repeatedly and at appropriateintervals in accordance with new or modified versions of the optimizedconfiguration 185.

FIG. 2A illustrates aspects of an example system environment forservice-oriented system optimization using trace data, including servicerelocation from host to host, according to some embodiments. Aservice-oriented system 200 may implement a service-orientedarchitecture and may include a plurality of hosts, any of which may beimplemented by the example computing device 3000 illustrated in FIG. 28.The hosts may be coupled using one or more networks 230. Although fourhosts 210A, 210B, 210C, and 210N are illustrated for purposes ofexample, it is contemplated that any suitable number of hosts may beused with the service-oriented system 200. The hosts 210A-210N may belocated in any suitable number of data centers and/or geographicallocations. For example, hosts 210B and 210C may be physically locatedwithin a zone 205, and hosts 210A and 210N may be physically locatedoutside the zone 205 (i.e., in one or more different zones). The zone205 may represent a geographical area, a data center, or a particularlocation (e.g., a rack) within a data center.

In one embodiment, individual hosts may be added to or subtracted fromthe service-oriented system 200, e.g., based on the computing resourcesrequired to run a particular set of services with a desired level ofperformance. Each host may run one or more services. For example, asshown in FIG. 2A, host 210A may run an instance of service 110A, host210B may run an instance of service 110B, and host 210N may run aninstance of service 110N. In one embodiment, multiple services and/orinstances of the same service may be implemented using the same host. Itis contemplated that the service-oriented system 200 and/or optimizationsystem 150 may include additional components not shown, fewer componentsthan shown, or different combinations, configurations, or quantities ofthe components shown.

In some embodiments, the hosts 210A-210N may be implemented as virtualcompute instances or as physical compute instances. The virtual computeinstances and/or physical compute instances may be offered to clients,provisioned, and maintained by a provider network that managescomputational resources, memory resources, storage resources, andnetwork resources. A virtual compute instance may comprise one or moreservers with a specified computational capacity (which may be specifiedby indicating the type and number of CPUs, the main memory size, and soon) and a specified software stack (e.g., a particular version of anoperating system, which may in turn run on top of a hypervisor). One ormore virtual compute instances may be implemented by the examplecomputing device 3000 illustrated in FIG. 28.

In one embodiment, a suitable component of the service-oriented system200 may provision and/or configure the hosts 210A-210N. For example, thehosts 210A-210N may be provisioned from a pool of available computeinstances by selecting available compute instances with suitablespecifications and configuring the selected compute instances withsuitable software. In one embodiment, additional compute instances maybe added to the service-oriented system 200 as needed. In oneembodiment, compute instances may be returned to the pool of availablecompute instances from service-oriented system 200, e.g., if thecomputing instances are not needed at a particular point in time.Additionally, the software installed on the hosts may be modified. Aservice relocation controller 220 may implement such a provisioning andconfiguration functionality (potentially in conjunction with othercomponents) to cause one or more hosts to be added to theservice-oriented system 200, cause one or more hosts to be removed fromthe service-oriented system 200, cause one or more services to beremoved from one or more hosts, and/or cause one or more services to beadded to one or more hosts. The service relocation controller 220 may beimplemented by the example computing device 3000 illustrated in FIG. 28and may be implemented as a physical compute instance or virtual computeinstance.

The number of hosts and/or configuration of the hosts may be modified inaccordance with the optimized configuration 185. In one embodiment, thenumber and/or configuration of the hosts may be modified dynamically,e.g., while the service-oriented system 200 remains operational to serverequests. Based on the trace data, the optimization system 150 maygenerate an optimized configuration 185 in which the original instanceof the service 110A does not run on host 210A. The optimizedconfiguration 185 may instead indicate that another instance of theservice 110A should run on a different host 210C. In accordance with theoptimized configuration 185, the service-oriented system 200 may bemodified to relocate or migrate the service 110A from the original host210A to the new host 210C. As discussed above, the hosts 210A and 210Bmay be located in different zones, while the hosts 210B and 210C may belocated in the same zone 205. Due to the increased proximity of host210C to host 210B, the relocation of the service 110A may yieldperformance and/or cost improvements.

In one embodiment, the optimization system 150 may generate a servicerelocation plan 186 based on the optimized configuration 185 and sendthe plan to the service relocation controller 220. The servicerelocation plan 186 may include an indication of the original locationand/or host and the new location and/or host for each service whoselocation or host is modified in the optimized configuration 185. Usingthe service relocation plan 186, the service relocation controller 220may implement the relocation or migration of one or more services, suchas service 110A. Accordingly, the service relocation controller 220 mayprovision the host 210C (if necessary) and add the new instance of theservice 110A to the host 210C. Additionally, if so indicated in theservice relocation plan 186, the service relocation controller 220 mayremove the original instance of the service 110A from the host 210A. Insome scenarios, however, the original instance of the service 110A onhost 210A may be left in place to run in parallel with the new instanceof the service 110A on host 210C. In one embodiment, a service (e.g.,service 110A) may include multiple components that may runindependently, and only a portion of the service may be relocated basedon the optimized configuration 185. In one embodiment, the host 210A maybe removed from the service-oriented system 200 and returned to the poolof available hosts if it no longer provides any services after removalof the original instance of the service 110A. The service relocationcontroller 220 may also perform any steps needed to inform otherservices of the location of the new instance of the service 110A. Inthis manner, the service-oriented system 200 may be reconfigured toprovide improved performance (e.g., improved transit times, throughput,or reliability) or to be implemented at an improved cost.

FIG. 2B illustrates aspects of an example system environment forservice-oriented system optimization using trace data, includingmodification of the number of service instances, according to someembodiments. A service-oriented system 250 may implement aservice-oriented architecture and may include a plurality of hosts, anyof which may be implemented by the example computing device 3000illustrated in FIG. 28. The hosts may be coupled using one or morenetworks 230. Although four hosts 210A, 210B, 210C, and 210N areillustrated for purposes of example, it is contemplated that anysuitable number of hosts may be used with the service-oriented system250. The hosts 210A-210N may be located in any suitable number of datacenters and/or geographical locations. In one embodiment, individualhosts may be added to or subtracted from the service-oriented system250, e.g., based on the computing resources required to run a particularset of services with a desired level of performance. Each host may runone or more services. For example, as shown in FIG. 2B, hosts 210A and210C may run one or more instances of service 110A, host 210B may runone or more instances of service 110B, and host 210N may run one or moreinstances of service 110N. In one embodiment, multiple services and/orinstances of the same service may be implemented using the same host. Itis contemplated that the service-oriented system 250 and/or optimizationsystem 150 may include additional components not shown, fewer componentsthan shown, or different combinations, configurations, or quantities ofthe components shown.

As discussed with respect to FIG. 2A, a service relocation controller220 may implement a provisioning and configuration functionality(potentially in conjunction with other components) to cause one or morehosts to be added to the service-oriented system 250, cause one or morehosts to be removed from the service-oriented system 250, cause one ormore services to be removed from one or more hosts, and/or cause one ormore services to be added to one or more hosts. The number of hostsand/or configuration of the hosts may be modified in accordance with theoptimized configuration 185. In one embodiment, the number and/orconfiguration of the hosts may be modified dynamically, e.g., while theservice-oriented system 250 remains operational to serve requests.

Based on the trace data, the optimization system 150 may generate anoptimized configuration 185 in which the number of instances of one ormore services is modified. Accordingly, the optimized configuration 185may indicate that new instances of a particular service should be addedor activated and/or that instances of a particular service should bedeleted or deactivated. For example, the optimized configuration 185 mayindicate that a new instance of service 110A should be added to host210C to run in parallel with an original instance of service 110A onhost 210A. As another example, the optimized configuration 185 mayindicate that an instance of service 110B should be deleted from host210B while leaving another instance of the service 110B operational. Asyet another example, the optimized configuration 185 may indicate that anew instance of service 110N should be added to host 210N to run inparallel with an original instance of service 110N on host 210N. Inaccordance with the optimized configuration 185, the service-orientedsystem 250 may be modified to implement the addition(s) and deletion(s)of service instances.

In one embodiment, the optimization system 150 may generate a servicerelocation plan 186 based on the optimized configuration 185 and sendthe plan to the service relocation controller 220. The servicerelocation plan 186 may include an indication of the service and thehost for each instance of a service to be added or deleted in theoptimized configuration 185. Using the service relocation plan 186, theservice relocation controller 220 may implement the addition and/ordeletion of service instances. For example, the service relocationcontroller 220 may add the new instance of the service 110A to the host210C. As another example, the service relocation controller 220 maydelete an instance of the service 110B from the host 210B. As yetanother example, the service relocation controller 220 may add the newinstance of the service 110N to the host 210N. The service relocationcontroller 220 may also perform any steps needed to inform otherservices of the location of the new instances of the services. In thismanner, the service-oriented system 250 may be reconfigured to provideimproved performance (e.g., improved transit times, throughput, orreliability) or to be implemented at an improved cost.

FIG. 3A illustrates aspects of an example system environment forservice-oriented system optimization using trace data, including servicerelocation to a common host, according to some embodiments. Aservice-oriented system 300 may implement a service-orientedarchitecture and may include a plurality of hosts, any of which may beimplemented by the example computing device 3000 illustrated in FIG. 28.The hosts may be coupled using one or more networks 230. Although threehosts 210A, 210B, and 210N are illustrated for purposes of example, itis contemplated that any suitable number of hosts may be used with theservice-oriented system 300. The hosts 210A-210N may be located in anysuitable number of data centers and/or geographical locations. In oneembodiment, individual hosts may be added to or subtracted from theservice-oriented system 300, e.g., based on the computing resourcesrequired to run a particular set of services with a desired level ofperformance. Each host may run one or more services. For example, asshown in FIG. 3A, host 210A may run an instance of service 110A, host210B may run an instance of service 110B, and host 210N may run aninstance of service 110N. In one embodiment, multiple services and/orinstances of the same service may be implemented using the same host. Itis contemplated that the service-oriented system 300 and/or optimizationsystem 150 may include additional components not shown, fewer componentsthan shown, or different combinations, configurations, or quantities ofthe components shown.

As discussed with respect to FIG. 2A, a service relocation controller220 may implement a provisioning and configuration functionality(potentially in conjunction with other components) to cause one or morehosts to be added to the service-oriented system 300, cause one or morehosts to be removed from the service-oriented system 300, cause one ormore services to be removed from one or more hosts, and/or cause one ormore services to be added to one or more hosts. The number of hostsand/or configuration of the hosts may be modified in accordance with theoptimized configuration 185. In one embodiment, the number and/orconfiguration of the hosts may be modified dynamically, e.g., while theservice-oriented system 300 remains operational to serve requests.

Based on the trace data, the optimization system 150 may generate anoptimized configuration 185 in which the original instance of theservice 110B does not run on host 210B. The optimized configuration 185may instead indicate that another instance of the service 110B shouldrun on a different host 210A. The hosts 210A and 210B may be located inany suitable locations relative to each other. For example, the hostsmay be implemented as two different virtual compute instances on a setof shared computing hardware, the hosts may be implemented usingdifferent computing devices located near each other in the same datacenter, or the hosts may be implemented using different computingdevices in two different data centers. In accordance with the optimizedconfiguration 185, the service-oriented system 300 may be modified torelocate or migrate the service 110B from the original host 210B to thenew host 210A.

In one embodiment, the optimization system 150 may generate a servicerelocation plan 186 based on the optimized configuration 185 and sendthe plan to the service relocation controller 220. The servicerelocation plan 186 may include an indication of the original locationand/or host and the new location and/or host for each service whoselocation or host is modified in the optimized configuration 185. Usingthe service relocation plan 186, the service relocation controller 220may implement the relocation or migration of one or more services, suchas service 110B. Accordingly, the service relocation controller 220 mayadd the new instance of the service 110B to the host 210A. Additionally,if so indicated in the service relocation plan 186, the servicerelocation controller 220 may remove the original instance of theservice 110B from the host 210B. In some scenarios, however, theoriginal instance of the service 110B on host 210B may be left in placeto run in parallel with the new instance of the service 110B on host210A. In one embodiment, the host 210B may be removed from theservice-oriented system 300 and returned to the pool of available hostsif it no longer provides any services after removal of the originalinstance of the service 110B. The service relocation controller 220 mayalso perform any steps needed to inform other services of the locationof the new instance of the service 110B. In this manner, theservice-oriented system 300 may be reconfigured to provide improvedperformance (e.g., improved transit times, throughput, or reliability)or to be implemented at an improved cost.

In one embodiment, the service 110A and the service 110B may be servicesthat frequently communicate with one another, e.g., with one of theservices as a requesting service and the other service as the requestedservice. By locating both of the services 110A and 110B on the same host210A, the performance of any service calls between the two services maybe improved. The services 110A and 110B may run in different processspaces and may communicate with one another on the host 210A using aloopback functionality, shared memory, or other virtual networkinterface. In this manner, the use of network resources may be minimizedfor service calls between the instances of services 110A and 110B on thehost 210A, and the speed of such calls may be improved. Additionally,the costs of preparing a message for network transport and processingsuch a received message may be removed or reduced.

FIG. 3B illustrates aspects of an example system environment forservice-oriented system optimization using trace data, including servicerelocation to a virtual machine on a common host, according to someembodiments. A service-oriented system 350 may implement aservice-oriented architecture and may include a plurality of hosts, anyof which may be implemented by the example computing device 3000illustrated in FIG. 28. The hosts may be coupled using one or morenetworks 230. Although three hosts 210A, 210B, and 210N are illustratedfor purposes of example, it is contemplated that any suitable number ofhosts may be used with the service-oriented system 350. The hosts210A-210N may be located in any suitable number of data centers and/orgeographical locations. In one embodiment, individual hosts may be addedto or subtracted from the service-oriented system 350, e.g., based onthe computing resources required to run a particular set of serviceswith a desired level of performance. Each host may run one or moreservices. For example, as shown in FIG. 3B, host 210A may run aninstance of service 110A, host 210B may run an instance of service 110B,and host 210N may run an instance of service 110N. In one embodiment,multiple services and/or instances of the same service may beimplemented using the same host. It is contemplated that theservice-oriented system 350 and/or optimization system 150 may includeadditional components not shown, fewer components than shown, ordifferent combinations, configurations, or quantities of the componentsshown.

As discussed with respect to FIG. 2A, a service relocation controller220 may implement a provisioning and configuration functionality(potentially in conjunction with other components) to cause one or morehosts to be added to the service-oriented system 350, cause one or morehosts to be removed from the service-oriented system 350, cause one ormore services to be removed from one or more hosts, and/or cause one ormore services to be added to one or more hosts. The number of hostsand/or configuration of the hosts may be modified in accordance with theoptimized configuration 185. In one embodiment, the number and/orconfiguration of the hosts may be modified dynamically, e.g., while theservice-oriented system 350 remains operational to serve requests.

Based on the trace data, the optimization system 150 may generate anoptimized configuration 185 in which the original instance of theservice 110B does not run on host 210B. The optimized configuration 185may instead indicate that another instance of the service 110B shouldrun on a different host 210A. The hosts 210A and 210B may be located inany suitable locations relative to each other. For example, the hostsmay be implemented as two different virtual compute instances on a setof shared computing hardware, the hosts may be implemented usingdifferent computing devices located near each other in the same datacenter, or the hosts may be implemented using different computingdevices in two different data centers. In accordance with the optimizedconfiguration 185, the service-oriented system 350 may be modified torelocate or migrate the service 110B from the original host 210B to thenew host 210A. Additionally, the new instance of the service 110B may beinstalled on the same virtual machine 215A as the service 110A on thehost 210A. In various embodiments, the use of the same virtual machine215A to run instances of both services 110A and 110B may or may not beindicated in the optimized configuration 185.

In one embodiment, the optimization system 150 may generate a servicerelocation plan 186 based on the optimized configuration 185 and sendthe plan to the service relocation controller 220. The servicerelocation plan 186 may include an indication of the original locationand/or host and the new location and/or host for each service whoselocation or host is modified in the optimized configuration 185. In oneembodiment, the service relocation plan 186 may also include anindication that the relocated service should be installed on aparticular virtual machine on the new host. Using the service relocationplan 186, the service relocation controller 220 may implement therelocation or migration of one or more services, such as service 110B.Accordingly, the service relocation controller 220 may add the newinstance of the service 110B to the host 210A. Additionally, if soindicated in the service relocation plan 186, the service relocationcontroller 220 may remove the original instance of the service 110B fromthe host 210B. In some scenarios, however, the original instance of theservice 110B on host 210B may be left in place to run in parallel withthe new instance of the service 110B on host 210A. In one embodiment,the host 210B may be removed from the service-oriented system 350 andreturned to the pool of available hosts if it no longer provides anyservices after removal of the original instance of the service 110B. Theservice relocation controller 220 may also perform any steps needed toinform other services of the location of the new instance of the service110B. In this manner, the service-oriented system 350 may bereconfigured to provide improved performance (e.g., improved transittimes, throughput, or reliability) or to be implemented at an improvedcost.

In one embodiment, the service 110A and the service 110B may be servicesthat frequently communicate with one another, e.g., with one of theservices as a requesting service and the other service as the requestedservice. By locating both of the services 110A and 110B on the samevirtual machine 215A on the same host 210A, the performance of anyservice calls between the two services may be improved. The services110A and 110B may communicate with one another on the host 210A usingany suitable form of inter-process communication, e.g., the use ofshared memory with a message-passing model to pass requests and/or data(or references thereto) back and forth. In this manner, the use ofnetwork resources may be minimized for service calls between theinstances of services 110A and 110B on the host 210A, and the speed ofsuch calls may be improved. Additionally, the costs of preparing amessage for network transport and processing such a received message(e.g., the costs of compression, decompression, encryption, decryption,serialization, and/or deserialization) may be removed or reduced.

FIG. 4 illustrates aspects of an example system environment forservice-oriented system optimization using trace data, including requestrouting, according to some embodiments. In one embodiment, a component420 may be configured for routing requests to target services within aservice-oriented system 400. For example, service requests may bereceived at a load balancer, and the load balancer may be configured forrequest routing. The request router 420 may be implemented by theexample computing device 3000 illustrated in FIG. 28 and may beimplemented as a physical compute instance or virtual compute instance.In one embodiment, service requests may be received from services (e.g.,services 110A, 110B, and 110N) within the service-oriented system 400.

The service-oriented system 400 may include a plurality of hosts, e.g.,as hosts 210A, 210B, and 210N. Each host may run one or more services,e.g., as services 110A, 110B, and 110N. Although three hosts 210A-210Nand three services 110A-110N are illustrated for purposes of example, itis contemplated that any suitable number of hosts and services may beused with the service-oriented system 400. The services 110A-110N mayrepresent different services and/or different instances of the sameservice. In one embodiment, new service requests may also originate fromthe services 110A-110N.

In one embodiment, the optimization system 150 may generate a servicerelocation plan 186 based on the optimized configuration 185 and sendthe plan to the request router 420. The service relocation plan 186 mayinclude an indication of the current host for each instance of a servicewhose host is modified in the optimized configuration 185. Using theservice relocation plan 186, the request router 420 may properly mapservice requests to instances of services in the modified configurationof the service-oriented system 400. In one embodiment, service requestsmay be routed by the request router 420 to particular instances ofservices in a manner that provides optimized performance (e.g., networklatency, throughput, or reliability) or optimized cost. For example, anincoming request may be routed to a particular instance of a servicebased on the proximity of the sender of the request to various instancesof the target service. In other words, the particular instance may beselected as the recipient of the request based on the proximity of thesender of the request to various instances of the target service. Asanother example, an incoming request may be routed to a particularinstance of a service based on the anticipated latency or cost ofsending the request to various instances of the target service. In otherwords, the particular instance may be selected as the recipient of therequest based on the anticipated latency or cost of sending the requestto various instances of the target service.

In various embodiments, the routing of service requests in this mannermay be performance instead of service relocation (as illustrated inFIGS. 2A, 2B, 3A, and 3B) or in addition to service relocation. In oneembodiment, services may be migrated to appropriate locations within theservice-oriented system 400 prior to implementing request routing. Inone embodiment, new instances of services may be added in appropriatelocations within the service-oriented system 400 prior to implementingrequest routing. In one embodiment, instances of services may be removedfrom appropriate locations within the service-oriented system 400 priorto implementing request routing.

FIG. 5 is a flowchart illustrating a method for service-oriented systemoptimization using trace data, according to some embodiments. As shownin 505, service interactions between services may be monitored, andtrace data describing aspects of the interactions may be generated bythe monitoring. The monitoring may be performed using instrumentation ofindividual services. In one embodiment, the trace data may be generatedin real-time or near real-time, e.g., as service requests and serviceresponses are received and/or processed by the services. The trace datamay include data indicative of relationships between individualservices, such as an identification of the calling (i.e., requesting)service and the called (i.e., requested) service for each interaction.The trace data may include one or more request identifiers that areusable to identify paths of service requests and responses from serviceto service. Request identifiers are discussed in greater detail belowwith respect to FIG. 21 through FIG. 26. The trace data may also includedata describing the performance of the service interactions. Forexample, the trace data may include data indicative of network latencyfor a request or response, data indicative of network throughput for oneor more interactions, data indicative of reliability or availability forone or more services, etc. The trace data generated for multipleservices and multiple service interactions may be sent to anoptimization system for aggregation and analysis.

As shown in 510, one or more performance metrics may be determined basedon the trace data. In one embodiment, the optimization system mayanalyze the trace data to determine the one or more performance metrics.At least a portion of the performance metrics may be determined forindividual interactions between services. For example, the optimizationsystem may calculate the client-measured latency for an interactionbased on the time at which a request was sent by a service and also onthe time at which a response to the request was received by the service.The optimization system may also calculate the server-measured latencyfor an interaction based on the time at which a request was received bya service and also on the time at which a response to the request wassent by the service. The network transit time for the interaction may becalculated as the difference between the client-measured latency and theserver-measured latency. The performance metrics may include dataindicative of network latency, throughput, reliability, cost, etc. Inone embodiment, the performance metrics may be determined based on otherdata sources (e.g., a cost database) in addition to the trace data.

As shown in 515, one or more call graphs may be determined based on thetrace data. Using the trace data received from various services, theoptimization system may build one or more call graphs that capture theinteractions between the services. Each call graph may include aplurality of nodes representing services and one or more edges (alsoreferred to as a call paths) representing service interactions. Callgraphs are discussed in greater detail below with respect to FIG. 21through FIG. 26.

As shown in 520, an optimized configuration may be determined for atleast a portion of the one or more call graph(s). The optimizedconfiguration for a set of services may represent an improvement on theexisting configuration of the set of services with respect to one ormore performance metrics (e.g., network latency or transit times,throughput, reliability, cost, etc.). Accordingly, the optimizedconfiguration may be determined based on the one or more performancemetrics determined in 510 in order to optimize one or more call paths ofthe one or more call graphs. In one embodiment, the optimizedconfiguration may be determined such that it improves a totalperformance metric for one or more call paths. For example, theoptimized configuration may minimize or decrease the network latency forone or more call paths, maximize or increase the throughput for one ormore call paths, maximize or increase the service reliability oravailability for one or more call paths, or minimize or decrease thecost for one or more call paths.

As shown in 525, the location(s) of one or more services may be modifiedbased on the optimized configuration. In one embodiment, one or moreservices may be moved to a different host. In one embodiment, a servicemay be moved to the same host as another service with which it shares acall path. In one embodiment, a service may be moved to the same virtualmachine on the same host as another service with which it shares a callpath. In one embodiment, the number of instances of a service may beincreased or decreased. In this manner, the performance of theservice-oriented system may be improved using trace data.

Partial Service Relocation

FIG. 6A illustrates an example system environment for service-orientedsystem optimization using partial service relocation, according to someembodiments. The example system environment may include aservice-oriented system 600 and an optimization system 650. As discussedabove with respect to FIG. 1, the service-oriented system 600 mayimplement a service-oriented architecture and may include multipleservices configured to communicate with each other (e.g., throughmessage passing) to carry out various tasks, such as business functions.Although two services 110D and 110E are illustrated for purposes ofexample, it is contemplated that any suitable number of services may beused with the service-oriented system 600. The services 110D-110E may beimplemented using a plurality of hosts, any of which may be implementedby the example computing device 3000 illustrated in FIG. 28. The hostsmay be located in any suitable number of data centers or geographicallocations. In one embodiment, multiple services and/or instances of thesame service may be implemented using the same host. It is contemplatedthat the service-oriented system 600 and/or optimization system 650 mayinclude additional components not shown, fewer components than shown, ordifferent combinations, configurations, or quantities of the componentsshown.

Each service 110D-110E may be configured to perform one or morefunctions upon receiving a suitable request. For example, a service maybe configured to retrieve input data from one or more storage locationsand/or from a service request, transform or otherwise process the data,and generate output data. In some cases, a first service may call asecond service, the second service may call a third service to satisfythe request from the first service, and so on. For example, to build aweb page dynamically, numerous services may be invoked in a hierarchicalmanner to build various components of the web page. In some embodiments,services may be loosely coupled in order to minimize (or in some caseseliminate) interdependencies among services. This modularity may enableservices to be reused in order to build various applications through aprocess referred to as orchestration. A service may include one or morecomponents that may also participate in the service-oriented system,e.g., by passing messages to other services or to other componentswithin the same service.

The service-oriented system 600 may be configured to process requestsfrom various internal or external systems, such as client computersystems or computer systems consuming networked-based services (e.g.,web services). For instance, an end-user operating a web browser on aclient computer system may submit a request for data (e.g., dataassociated with a product detail page, a shopping cart application, acheckout process, search queries, etc.). In another example, a computersystem may submit a request for a web service (e.g., a data storageservice, a data query, etc.). In general, services may be configured toperform any of a variety of business processes.

The services 110D-110E described herein may include but are not limitedto one or more of network-based services (e.g., a web service),applications, functions, objects, methods (e.g., objected-orientedmethods), subroutines, or any other set of computer-executableinstructions. In various embodiments, such services may communicatethrough any of a variety of communication protocols, including but notlimited to the Simple Object Access Protocol (SOAP). In variousembodiments, messages passed between services may include but are notlimited to Extensible Markup Language (XML) messages or messages of anyother markup language or format. In various embodiments, descriptions ofoperations offered by one or more of the services may include WebService Description Language (WSDL) documents, which may in some casesbe provided by a service broker accessible to the services andcomponents. References to services herein may include components withinservices.

As discussed with reference to FIG. 1, each of the services 110D-110Emay be configured with one or more components for monitoringinteractions between services. The interaction monitoring functionalityfor each service may monitor or track interactions between thecorresponding service and other services (or components of services) inthe service-oriented system 600. The monitored interactions may includeservice requests (i.e., requests for services to be performed),responses to requests, and other suitable events. In one embodiment, theinteraction monitoring functionality may monitor service interactionssuch as service requests and service responses in any suitableenvironment, such as a production environment and/or a test environment.To monitor the service requests and responses, lightweightinstrumentation may be added to services. The instrumentation (e.g., areporting agent associated with each service) may collect and reportdata associated with each inbound request, outbound request, or otherservice interaction (e.g., a timer-based interaction) processed by aservice. As discussed above with respect to FIG. 1, a service maycollect trace data and send the trace data to the optimization system650. The trace data may describe aspects of the service interactions.Further aspects of the interaction monitoring functionality arediscussed below with respect to FIG. 21 through FIG. 26.

In one embodiment, the optimization system 650 may include a pluralityof components configured for optimization of the service-oriented system600. For example, the optimization system 650 may include a codeanalysis functionality 660, a data flow analysis functionality 170, andan optimizer functionality 180. In one embodiment, the optimizationsystem 650 may also include a performance analysis functionality 160 asshown in FIG. 1. The optimization system 650 may include one or morecomputing devices, any of which may be implemented by the examplecomputing device 3000 illustrated in FIG. 28. In various embodiments,the functionality of the different services, components, and/or modulesof the optimization system 650 may be provided by the same computingdevice or by different computing devices. If any of the variouscomponents are implemented using different computing devices, then therespective computing devices may be communicatively coupled, e.g., via anetwork. Each one of the code analysis functionality 660, the data flowanalysis functionality 170, and the optimizer functionality 180 mayrepresent any combination of software and hardware usable to performtheir respective functions, as discussed as follows.

Using the code analysis functionality 660, the optimization system 150may analyze the program code of one or more of the services in theservice-oriented system 600. For example, the code analysisfunctionality 660 may be used to analyze the program code of service110D. In one embodiment, the code analysis functionality 660 may analyzethe program code of a service to determine which portions of the programcode are suitable for inclusion in a newly generated service that issmaller in size (e.g., in length of code or number of instructions). Inone embodiment, the code analysis functionality 660 may determine whichportions of the program code are frequently used code 140D and whichportions of the code are infrequently used code 145D. Any suitabletechnique(s) may be used to determine the frequently used code 140D andthe infrequently used code 145D. As used herein, the terms “frequent” or“frequently used” and “infrequent” or “infrequently used” may bedetermined relative to any suitable threshold. For example, the servicemay be executed for many service interactions involving different inputparameters, either in a production environment or in a test environment.The interactions may be monitored, and trace data may be generateddescribing aspects of the interactions. Using the trace data, thefrequency at which a particular portion of the program code is executedmay be determined as a percentage of all interactions involving theservice, and the portions of the program code above a particularfrequency threshold may be assigned to the frequently used code 140D.Conversely, portions of the program code below a particular frequencythreshold may be assigned to the infrequently used code 145D.Accordingly, the frequently used code 140D and infrequently used code145D may be determined based on a set of trace data, e.g., for aparticular context associated with a set of services and serviceinteractions. In one embodiment, the infrequently used code 145D maynever be used in a particular context defined by trace data. In oneembodiment, the frequently used code 140D and the infrequently used code145D may collectively represent all or nearly all of the originalprogram code of the service 110D.

Based on the code analysis functionality 660, the optimization system650 may generate one or more new services that are based on the programcode of the service 110D but smaller in size (e.g., in length of code ornumber of instructions). For example, the optimization system 650 maygenerate a new service 110E that includes the frequently used code 140Dand excludes the infrequently used code 145D. The service 110E may alsobe referred to as a partial service. The partial service 110E may bedeployed in any suitable location and in any suitable number ofinstances in the service-oriented system 600. As will be discussedbelow, the optimizer 180 may generate an optimized configuration 185that indicates the number of instances and locations for deploying thepartial service 110E. The partial service 110E may require fewerresources (e.g., computational resources, memory resources, networkresources, etc.) to execute than the original service 110D. Accordingly,deployment of the partial service 110E to supplement or replace theoriginal service 110D may improve the performance of theservice-oriented system 600.

In one embodiment, the partial service 110E may be optimized forexecution within a particular context, e.g., within a particular subsetof a call graph as determined based on trace data. For example, thepartial service 110E may be optimized for interaction with one or morerequesting services (i.e., services that call the partial service 110E).Trace data and/or program code instrumentation may be used to determinewhich parameters are passed to a service and which portions of code areexecuted as a result. In some contexts, clients may invoke only a subsetof the functionality of the original service 110D, e.g., by passing onlya limited set of parameters (potentially as few as one of theparameters) to the original service 110D. Only the portion of theprogram code that handles those one or more parameters may be executedon a regular basis in a context where the original service 110D iscalled by a particular set of clients. For example, if theservice-oriented system 600 implements an online marketplace, only oneparticular currency or one particular shipping option may be used fortransactions in a particular geographical context. In one embodiment,the frequently used code 140D may be repackaged for deployment in thatcontext, e.g., to be invoked by a particular set of clients that passonly a limited set of parameters to the service. In one embodiment, ifthe partial service 110E is generated for use with only one inputparameter, the requirement to pass that parameter may be eliminated whenthe partial service 110E is generated.

In some embodiments, the code analysis and partial service generationmay vary based on the language(s) in which the original service 110D iswritten. In one embodiment, the code analysis functionality 660 mayinclude a code coverage analyzer for the original service 110D,particularly where the program code is expressed in a compiled language.In one embodiment, the program code of the original service 110D may bewritten in an interpreted language rather than in a compiled language.Instead of being compiled before deployment, code written in such alanguage may be deployed as written and then interpreted (e.g., using onthe fly compilation) on the hosts where it is run. The interpretedprogram code may be easier to divide and relocate because it has notbeen compiled to harden its library dependencies. The code analysisfunctionality 660 may analyze the program code to prove that some of thecode is not executed for particular input parameters or in a particularcontext (e.g., in a subset of a call graph). For example, the service110D may be partially evaluated for particular input parameters. In oneembodiment, trace data may be used to determine the input parametersthat are used for the partial evaluation. The portions of code that arenot executed in such circumstances may be assigned to the infrequentlyused code 145D and excluded from the repackaged service 110E.

In one embodiment, the program code of the original service 110D that isanalyzed and repackaged may be written in a declarative, interpretedlanguage. For example, the program code may be written using a languagethat decoupled business logic from underlying execution environments.The program code may be written using a framework for precomputingresults, e.g., by defining a query that produces the results to beprecomputed, specifying where the query results should be stored,specifying which inputs should be monitored and which should be ignored,and launching a model in a hosted environment that scales up or downdepending on the required capacity. A model may include a view as abuilding block of a query. Views may point to underlying input data, orthey may be layered to join or transform other views to produce someresult. Views may be blueprints for how a computation should be done andfor computing the effects of a change. A model may include a replicathat designates storage for a view. Additionally, a model may include areplicator that behaves like a trigger. The replicator may declare thatchanges from a particular input source should be propagated to aparticular replica. The model may make a number of statements that canbe verified, e.g., by determining whether a view yields the expectedresults or whether input changes propagate as expected. A unit-testingframework may enable verification of a model without making externalservice calls.

As discussed above with respect to FIG. 1, using the data flow analysisfunctionality 170, the optimization system 650 may analyze the tracedata and generate one or more call graphs 175 based on connectivityinformation within the trace data. Each call graph may represent theflow of requests from service to service and may identify servicedependencies. Each call graph may include a plurality of nodesrepresenting services and one or more edges (also referred to as callpaths) representing service interactions. Each of the call graphs 175may include a hierarchical data structure that includes nodesrepresenting the services and edges representing the interactions. Insome cases, a call graph may be a deep and broad tree with multiplebranches each representing a series of related service calls. The dataflow analysis functionality 170 may use any suitable data and metadatato build each call graph, such as request identifiers and metadataassociated with services and their interactions. The request identifiersand metadata are discussed below with respect to FIG. 21 through FIG.26. In one embodiment, the data flow analysis functionality 170 mayanalyze the trace data and generate suitable reports and/orvisualizations (e.g., call graph visualizations) based on the tracedata.

The generation of a particular call graph may be initiated based on anysuitable determination. In one embodiment, the call graph generation maybe initiated after a sufficient period of time has elapsed with nofurther service interactions made for any relevant service. In oneembodiment, heuristics or other suitable rule sets may be used todetermine a timeout for a lack of activity to satisfy a particular rootrequest. The timeout may vary based on the nature of the root request.For example, a root request to generate a web page using a hierarchy ofservices may be expected to be completed within seconds; accordingly,the call graph may be finalized within seconds or minutes.

Using the optimizer functionality 180, the optimization system 150 maydetermine an optimized configuration 185 for at least a portion of theone or more call graph(s). As used herein, the term “optimized”generally means “improved” rather than “optimal.” The optimizedconfiguration 185 for a set of services may represent an improvement onthe existing configuration of the set of services with respect to one ormore performance metrics (e.g., network latency or transit times,throughput, reliability or availability, cost, etc.) for at least aportion of the one or more call graphs. Accordingly, the optimizedconfiguration 185 may be determined based on the code analysis 660 andoptionally based on one or more performance metrics in order to optimizeone or more call paths of the one or more call graphs 175. In oneembodiment, the optimized configuration 185 may also be determined basedon additional information that is not derived from trace data, such asan expense associated with each service instance, service interaction,host, and/or unit of resource consumption. In one embodiment, theoptimized configuration 185 may be determined such that it minimizes,maximizes, decreases, or increases a total performance metric for one ormore call paths. For example, the optimized configuration 185 mayminimize or reduce the network latency for one or more call paths,maximize or increase the throughput for one or more call paths, maximizeor increase the reliability or availability for one or more call paths,or minimize or reduce the cost for one or more call paths. The optimizer180 may take into account the sensitivity of a particular call path tolatency, e.g., whether improving the latency of one event would improvethe latency of another event in a call graph. Any suitable component(s)may be used to implement the optimizer 180. For example, the optimizer180 may be implemented using a constrained optimization solver which isconfigured to minimize a cost function or an energy function in thepresence of one or more constraints or to maximize a reward function ora utility function in the presence of one or more constraints. Theoptimizer 180 may generate an optimized configuration 185 by optimizinga user-defined function of network latency, throughput, reliability,cost, and/or any other suitable term(s).

In one embodiment, data and/or metadata associated with a request orresponse may be compressed, encrypted, or serialized by a service.Similarly, data and/or metadata associated with a request or responsemay be decompressed, decrypted, or deserialized upon receipt by aservice. The cost or time associated with compression, decompression,encryption, decryption, serialization, and/or deserialization may betaken into account by the optimizer 180. Accordingly, performancemetrics associated with the costs of preparing a message for networktransport and processing such a received message (e.g., the costs ofcompression, decompression, encryption, decryption, serialization,and/or deserialization) may be collected as part of the trace data.Additionally, the optimizer 180 may take into account such performancedata as CPU (central processing unit) utilization for program code,memory utilization for program code, and any other suitable data. In oneembodiment, the optimization system 650 may collect performance datafrom sources other than the interaction monitoring components.

In one embodiment, the optimization system 650 may receive a continuousstream of trace data from the service-oriented system 600. Theoptimization system 650 may generate and/or modify the optimizedconfiguration 185 repeatedly and at appropriate intervals. Similarly,the placement of services may be modified repeatedly and at appropriateintervals in accordance with new or modified versions of the optimizedconfiguration 185. In one embodiment, the optimized configuration 185for one or more partial services may be generated periodically, such aswhen a software deployment occurs or when a traffic analysis isperformed. In one embodiment, the optimized configuration 185 for one ormore partial services may be generated to optimize the use of anysuitable computational resources, such as processor resources, memoryresources, and/or network resources.

FIG. 6B illustrates further aspects of an example system environment forservice-oriented system optimization using partial service relocation,according to some embodiments. A service-oriented system 601 may includean original service 110D. As discussed above with respect to FIG. 6A,using the code analysis functionality 660, the optimization system 650may determine a portion of the service 110D that is frequently used code140D and another portion that is infrequently used code 145D. Theoptimization system 650 may generate a plurality of new services, suchas service 110F and 110G, based on the code analysis. The partialservice 110F may include the frequently used code 140D. The partialservice 110F may also include a service call 146D in place of theinfrequently used code 145D. The service call 146D may invoke yetanother service 110G that includes the infrequently used code 145D.Alternatively, the service call 146D may invoke the functionality of theinfrequently used code 145D in an instance of the original service 110D.One or more instances of the partial service 110F and optionally one ormore instances of the service 110G may then be deployed based on theoptimized configuration 185. By giving the partial service 110F theability to invoke the functionality of the infrequently used code 145D,the partial service 110F may improve the performance of theservice-oriented system 601 while potentially being deployed in a widerrange of contexts than the partial service 110E. For example, anoptimized configuration of services for processing a very large list ofitems (e.g., in a large “shopping cart” for an online merchant) maydiffer from an optimized configuration of services for processing asmaller list of items. In particular, the partial service 110F may beconfigured to run on smaller hosts for processing smaller lists, and thepartial service 110G may be configured to run on larger hosts forprocessing very large lists. The optimizer 180 may determine which ofthe partial services to deploy on which host class when it minimizes anenergy function for the service-oriented system.

FIG. 6C illustrates further aspects of an example system environment forservice-oriented system optimization using partial service relocation,including the use of a router, according to some embodiments. Aservice-oriented system 602 may include an original service 110D. Asdiscussed above with respect to FIG. 6A, using the code analysisfunctionality 660, the optimization system 650 may determine a portionof the service 110D that is frequently used code 140D and anotherportion that is infrequently used code 145D. The optimization system 650may generate one or more new services, such as service 110E, based onthe code analysis. As discussed above with respect to FIG. 6A, thepartial service 110E may include the frequently used code 140D. Theservice-oriented system 602 may also include a router 603 that may routeservice calls intended for the original service 110D to an instance ofthe original service 110D or to an instance of the partial service 110E.For example, the router 603 may analyze the incoming service request,such as by examining any input parameters associated with the servicerequest. If the router 603 determines that the request may be processedusing the frequently used code 140D, then the router may forward therequest to the partial service 110E. On the other hand, if the router603 determines that the request may not be processed using thefrequently used code 140D (e.g., that the request may be processed usingthe infrequently used code 145D), then the router may forward therequest to the original service 110D.

FIG. 6D illustrates further aspects of an example system environment forservice-oriented system optimization using partial service relocation,including the inlining of frequently used code, according to someembodiments. A service-oriented system 604 may include an originalservice 110D. As discussed above with respect to FIG. 6A, using the codeanalysis functionality 660, the optimization system 650 may determine aportion of the service 110D that is frequently used code 140D andanother portion that is infrequently used code 145D. Using trace datafor the service-oriented system 604, the optimization system 650 maydetermine that a particular client of the original service 110Dfrequently invokes the functionality of the frequently used code 140Dbut not necessarily the infrequently used code 145D. The optimizationsystem 650 may generate a new version of the client 610 that includes(e.g., inlines) the frequently used code 140D in place of the originalservice call to the original service 110D. In one embodiment, the newversion of the client may also include a service call 146D to theinfrequently used code. The service call 146D may invoke either a newservice (e.g., new service 110G, as shown in FIG. 6B) that includes theinfrequently used code 145D or an instance of the original service 110Dthat includes the infrequently used code 145D. One or more instances ofthe new client 610 and optionally one or more instances of the servicethat includes the infrequently used code 146D (e.g., service 110G) maythen be deployed based on the optimized configuration 185. By giving theclient 610 the ability to perform the code 140D that it most frequentlyinvokes without a service call, while also giving the client the abilityto invoke the functionality of the infrequently used code 145D, theoptimization system 650 may improve the performance of theservice-oriented system 604.

As will be described in greater detail below, the location(s) of one ormore partial services may be determined based on the optimizedconfiguration 185. In one embodiment, as illustrated in FIG. 7, one ormore partial services may be deployed to a different host than theoriginal service. In one embodiment, as illustrated in FIG. 8A, apartial service may be moved to the same host as another service, e.g.,a service with which it shares a call path. In one embodiment, asillustrated in FIG. 8B, a partial service may be moved to the samevirtual machine on the same host as another service, e.g., with which itshares a call path. In one embodiment, as illustrated in FIG. 8C, apartial service may be moved to the same process on the same host asanother service, e.g., with which it shares a call path. In this manner,the performance of the service-oriented system 600 and/or 601 may beimproved through the deployment of one or more partial services.

FIG. 7 illustrates aspects of an example system environment forservice-oriented system optimization using partial service relocation,including partial service relocation from host to host, according tosome embodiments. A service-oriented system 700 may implement aservice-oriented architecture and may include a plurality of hosts, anyof which may be implemented by the example computing device 3000illustrated in FIG. 28. The hosts may be coupled using one or morenetworks 230. Although four hosts 210B, 210D, 210E, and 210N areillustrated for purposes of example, it is contemplated that anysuitable number of hosts may be used with the service-oriented system200. The hosts 210B, 210D, 210E, and 210N may be located in any suitablenumber of data centers and/or geographical locations. For example, hosts210B and 210E may be physically located within a zone 705, and hosts210D and 210N may be physically located outside the zone 705 (i.e., inone or more different zones). The zone 705 may represent a geographicalarea, a data center, or a particular location (e.g., a rack) within adata center.

In one embodiment, individual hosts may be added to or subtracted fromthe service-oriented system 700, e.g., based on the computing resourcesrequired to run a particular set of services with a desired level ofperformance. Each host may run one or more services. For example, asshown in FIG. 7, host 210D may originally run an instance of service110D, host 210B may run an instance of service 110B, and host 210N mayrun an instance of service 110N. In one embodiment, multiple servicesand/or instances of the same service may be implemented using the samehost. It is contemplated that the service-oriented system 700 and/oroptimization system 650 may include additional components not shown,fewer components than shown, or different combinations, configurations,or quantities of the components shown.

In some embodiments, the hosts 210B, 210D, 210E, and 210N may beimplemented as virtual compute instances or as physical computeinstances. The virtual compute instances and/or physical computeinstances may be offered to clients, provisioned, and maintained by aprovider network that manages computational resources, memory resources,storage resources, and network resources. A virtual compute instance maycomprise one or more servers with a specified computational capacity(which may be specified by indicating the type and number of CPUs, themain memory size, and so on) and a specified software stack (e.g., aparticular version of an operating system, which may in turn run on topof a hypervisor). One or more virtual compute instances may beimplemented by the example computing device 3000 illustrated in FIG. 28.

In one embodiment, a suitable component of the service-oriented system700 may provision and/or configure the hosts 210B, 210D, 210E, and 210N.For example, the hosts 210B, 210D, 210E, and 210N may be provisionedfrom a pool of available compute instances by selecting availablecompute instances with suitable specifications and configuring theselected compute instances with suitable software. In one embodiment,additional compute instances may be added to the service-oriented system700 as needed. In one embodiment, compute instances may be returned tothe pool of available compute instances from service-oriented system700, e.g., if the computing instances are not needed at a particularpoint in time. Additionally, the software installed on the hosts may bemodified. A service relocation controller 220 may implement such aprovisioning and configuration functionality (potentially in conjunctionwith other components) to cause one or more hosts to be added to theservice-oriented system 700, cause one or more hosts to be removed fromthe service-oriented system 700, cause one or more services to beremoved from one or more hosts, and/or cause one or more services to beadded to one or more hosts. The service relocation controller 220 may beimplemented by the example computing device 3000 illustrated in FIG. 28and may be implemented as a physical compute instance or virtual computeinstance.

The number of hosts and/or configuration of the hosts may be modified inaccordance with the optimized configuration 185. In one embodiment, thenumber and/or configuration of the hosts may be modified dynamically,e.g., while the service-oriented system 700 remains operational to serverequests. As discussed above with respect to FIGS. 6A and 6B, theoptimization system 650 may generate an optimized configuration 185 inwhich the original instance of the service 110D does not run on host210D. The optimized configuration 185 may instead indicate that aninstance of the partial service 110E based on the original service 110Dshould run on a different host 210E. In accordance with the optimizedconfiguration 185, the service-oriented system 700 may be modified toremove the original service 110D from the original host 210D and deploythe partial service 110E to the host 210E. As discussed above, the hosts210D and 210B may be located in different zones, while the hosts 210Band 210E may be located in the same zone 705. Due to the increasedproximity of host 210E to host 210B, the relocation of the partialservice 110E may yield performance and/or cost improvements.

In one embodiment, the optimization system 650 may generate a servicerelocation plan 186 based on the optimized configuration 185 and sendthe plan to the service relocation controller 220. The servicerelocation plan 186 may include an indication of the original locationand/or host and the new location and/or host for each service whoselocation or host is modified in the optimized configuration 185. Usingthe service relocation plan 186, the service relocation controller 220may implement the relocation or migration of one or more services, suchas original service 110D and partial service 110E. Accordingly, theservice relocation controller 220 may provision the host 210E (ifnecessary) and add the new instance of the partial service 110E to thehost 210E. Additionally, if so indicated in the service relocation plan186, the service relocation controller 220 may remove the originalinstance of the service 110D from the host 210D. In some scenarios,however, the original instance of the service 110D on host 210D may beleft in place to run in parallel with the new instance of the partialservice 110E on host 210E. In one embodiment, a service may includemultiple components that may run independently, and only a portion ofthe service may be relocated based on the optimized configuration 185.In one embodiment, the host 210D may be removed from theservice-oriented system 700 and returned to the pool of available hostsif it no longer provides any services after removal of the originalinstance of the service 110D. The service relocation controller 220 mayalso perform any steps needed to inform other services of the locationof the new instance of the partial service 110E. In this manner, theservice-oriented system 700 may be reconfigured to provide improvedperformance (e.g., improved transit times, throughput, or reliability)or to be implemented at an improved cost.

FIG. 8A illustrates aspects of an example system environment forservice-oriented system optimization using partial service relocation,including partial service relocation to a common host, according to someembodiments. A service-oriented system 800 may implement aservice-oriented architecture and may include a plurality of hosts, anyof which may be implemented by the example computing device 3000illustrated in FIG. 28. The hosts may be coupled using one or morenetworks 230. Although three hosts 210E, 210D, and 210N are illustratedfor purposes of example, it is contemplated that any suitable number ofhosts may be used with the service-oriented system 800. The hosts 210E,210D, and 210N may be located in any suitable number of data centersand/or geographical locations. In one embodiment, individual hosts maybe added to or subtracted from the service-oriented system 800, e.g.,based on the computing resources required to run a particular set ofservices with a desired level of performance. Each host may run one ormore services. For example, as shown in FIG. 8A, host 210E may run aninstance of service 110A, host 210D may originally run an instance ofservice 110D, and host 210N may run an instance of service 110N. In oneembodiment, multiple services and/or instances of the same service maybe implemented using the same host. It is contemplated that theservice-oriented system 800 and/or optimization system 650 may includeadditional components not shown, fewer components than shown, ordifferent combinations, configurations, or quantities of the componentsshown.

As discussed with respect to FIG. 7, a service relocation controller 220may implement a provisioning and configuration functionality(potentially in conjunction with other components) to cause one or morehosts to be added to the service-oriented system 800, cause one or morehosts to be removed from the service-oriented system 800, cause one ormore services to be removed from one or more hosts, and/or cause one ormore services to be added to one or more hosts. The number of hostsand/or configuration of the hosts may be modified in accordance with theoptimized configuration 185. In one embodiment, the number and/orconfiguration of the hosts may be modified dynamically, e.g., while theservice-oriented system 800 remains operational to serve requests.

The optimization system 650 may generate an optimized configuration 185in which the instance of the original service 110D does not run on host210D. The optimized configuration 185 may instead indicate that aninstance of the partial service 110E should run on a different host210E. The hosts 210D and 210E may be located in any suitable locationsrelative to each other. For example, the hosts may be implemented as twodifferent virtual compute instances on a set of shared computinghardware, the hosts may be implemented using different computing deviceslocated near each other in the same data center, or the hosts may beimplemented using different computing devices in two different datacenters. In accordance with the optimized configuration 185, theservice-oriented system 800 may be modified to relocate or migrate thefrequently used functionality of the original service 110D from theoriginal host 210D to the new host 210E, e.g., by deploying the partialservice 110E to host 210E.

In one embodiment, the optimization system 650 may generate a servicerelocation plan 186 based on the optimized configuration 185 and sendthe plan to the service relocation controller 220. The servicerelocation plan 186 may include an indication of the original locationand/or host and the new location and/or host for each service whoselocation or host is modified in the optimized configuration 185. Usingthe service relocation plan 186, the service relocation controller 220may implement the relocation or migration of one or more services, suchas partial service 110E. Accordingly, the service relocation controller220 may add the new instance of the service 110E to the host 210E.Additionally, if so indicated in the service relocation plan 186, theservice relocation controller 220 may remove the original instance ofthe service 110D from the host 210D. In some scenarios, however, theoriginal instance of the service 110D on host 210D may be left in placeto run in parallel with the new instance of the service 110E on host210E. In one embodiment, the host 210D may be removed from theservice-oriented system 800 and returned to the pool of available hostsif it no longer provides any services after removal of the originalinstance of the service 110D. The service relocation controller 220 mayalso perform any steps needed to inform other services of the locationof the new instance of the service 110D. In this manner, theservice-oriented system 800 may be reconfigured to provide improvedperformance (e.g., improved transit times, throughput, or reliability)or to be implemented at an improved cost.

In one embodiment, the service 110A and the service 110E may be servicesthat frequently communicate with one another, e.g., with one of theservices as a requesting service and the other service as the requestedservice. By locating both of the services 110A and 110E on the same host210E, the performance of any service calls between the two services maybe improved. The services 110A and 110E may run in different processspaces and may communicate with one another on the host 210E using aloopback functionality, shared memory, or other virtual networkinterface. In this manner, the use of network resources may be minimizedfor service calls between the instances of services 110A and 110E on thehost 210E, and the speed of such calls may be improved. Additionally,the costs of preparing a message for network transport and processingsuch a received message may be removed or reduced.

FIG. 8B illustrates aspects of an example system environment forservice-oriented system optimization using partial service relocation,including partial service relocation to a virtual machine on a commonhost, according to some embodiments. As discussed above with respect toFIG. 8A, a service-oriented system 800 may implement a service-orientedarchitecture and may include a plurality of hosts, such as hosts 210E,210D, and 210N. Each host may run one or more services. For example, asshown in FIG. 8B, host 210E may run an instance of service 110A, host210D may originally run an instance of service 110D, and host 210N mayrun an instance of service 110N. The optimization system 650 maygenerate an optimized configuration 185 in which the instance of theoriginal service 110D does not run on host 210D. The optimizedconfiguration 185 may instead indicate that an instance of the partialservice 110E should run on a different host 210E. In accordance with theoptimized configuration 185, the service-oriented system 800 may bemodified to relocate or migrate the frequently used functionality of theoriginal service 110D from the original host 210D to the new host 210E,e.g., by deploying the partial service 110E to host 210E. Additionally,the new instance of the service 110E may be installed on the samevirtual machine 215E as the service 110A on the host 210A. In oneembodiment, the service relocation plan 186 may include an indicationthat the relocated service should be installed on the virtual machine215E on the new host 210E. In this manner, the service-oriented system800 may be reconfigured to provide improved performance (e.g., improvedtransit times, throughput, or reliability) or to be implemented at animproved cost.

In one embodiment, the service 110A and the service 110E may be servicesthat frequently communicate with one another, e.g., with one of theservices as a requesting service and the other service as the requestedservice. By locating both of the services 110A and 110E on the samevirtual machine 215E on the same host 210E, the performance of anyservice calls between the two services may be improved. The services110A and 110E may communicate with one another on the host 210A usingany suitable form of inter-process communication, e.g., the use ofshared memory with a message-passing model to pass requests and/or data(or references thereto) back and forth. In this manner, the use ofnetwork resources may be minimized for service calls between theinstances of services 110A and 110E on the host 210A, and the speed ofsuch calls may be improved. Additionally, the costs of preparing amessage for network transport and processing such a received message(e.g., the costs of compression, decompression, encryption, decryption,serialization, and/or deserialization) may be removed or reduced.

FIG. 8C illustrates aspects of an example system environment forservice-oriented system optimization using partial service relocation,including partial service relocation to a common process on a commonhost, according to some embodiments. As discussed above with respect toFIG. 8A, a service-oriented system 800 may implement a service-orientedarchitecture and may include a plurality of hosts, such as hosts 210E,210D, and 210N. Each host may run one or more services. For example, asshown in FIG. 8B, host 210E may run an instance of service 110A, host210D may originally run an instance of service 110D, and host 210N mayrun an instance of service 110N. The optimization system 650 maygenerate an optimized configuration 185 in which the instance of theoriginal service 110D does not run on host 210D. The optimizedconfiguration 185 may instead indicate that an instance of the partialservice 110E should run on a different host 210E. In accordance with theoptimized configuration 185, the service-oriented system 800 may bemodified to relocate or migrate the frequently used functionality of theoriginal service 110D from the original host 210D to the new host 210E,e.g., by deploying the partial service 110E to host 210E. Additionally,the new instance of the service 110E may be installed such that it runsin the same process 216E as the service 110A on the host 210E. In oneembodiment, the service relocation plan 186 may include an indicationthat the relocated service should be installed to run in the sameprocess 216E on the new host 210E. In this manner, the service-orientedsystem 800 may be reconfigured to provide improved performance (e.g.,improved transit times, throughput, or reliability) or to be implementedat an improved cost.

In one embodiment, the service 110A and the service 110E may be servicesthat frequently communicate with one another, e.g., with one of theservices as a requesting service and the other service as the requestedservice. By executing both of the services 110A and 110E in the sameprocess 216E on the same host 210E, the performance of any interactionsbetween the two services may be improved. The services 110A and 110E maycommunicate with one another on the host 210A using any suitable form ofcommunication, e.g., the use of shared memory. In this manner, the useof network resources may be minimized for interactions between theinstances of services 110A and 110E on the host 210A, and the speed ofsuch interactions may be improved. Additionally, the costs of preparinga message for network transport and processing a received message (e.g.,the costs of compression, decompression, encryption, decryption,serialization, and/or deserialization) may be removed or reduced.

FIG. 9 is a flowchart illustrating a method for service-oriented systemoptimization using partial service relocation, according to someembodiments. As shown in 905, service interactions at services in aservice-oriented system may be monitored, and trace data describing theinteractions may be generated. As shown in 910, one or more performancemetrics may be generated based on the trace data.

As shown in 915, a code analysis may be performed automatically toanalyze the program code of an original service. The automated codeanalysis may be performed automatically (e.g., without being directlyprompted by user input) and/or programmatically (e.g., according toprogram instructions). The automated code analysis may determine thatone set of program code in the original service is frequently usedwithin a particular context defined by the trace data. Similarly, theautomated code analysis may determine that another set of program codein the original service is infrequently used within the particularcontext defined by the trace data. In one embodiment, the infrequentlyused code may never be used in the particular context. The frequency ofuse may be determined using the code analysis, e.g., by monitoring theprogram code during service interactions in a production environment ortest environment.

As shown in 920, an optimized configuration may be determined for theservice-oriented system. The optimized configuration may be determinedbased on the trace data and/or the performance metrics. As shown in 925,a partial service may be generated based on the code analysis of theoriginal service. The partial service may include the frequently usedcode from the original service. The partial service may also exclude theinfrequently used code from the original service. In one embodiment, theoptimized configuration may indicate a number of instances of thepartial service to deploy and one or more locations to deploy thepartial service in the service-oriented system. As shown in 930, atleast one instance of the partial service may be deployed based on theoptimized configuration. In one embodiment, any of the operations shownin 905-930 may be performed multiple times over an interval of time tooptimize one or more services in a service-oriented system in acontinuous manner.

Optimization Using Static Analysis

FIG. 10 illustrates an example system environment for service-orientedsystem optimization using cross-service static analysis, according tosome embodiments. The example system environment may include a set ofservice code 1010 for a plurality of services and an optimization system1050. The services may be intended for deployment in a service-orientedsystem. As discussed above with respect to FIG. 1 and FIG. 6A, theservice-oriented system may implement a service-oriented architectureand may include multiple services configured to communicate with eachother (e.g., through message passing) to carry out various tasks, suchas business functions. Although three services 110A and 110B through110N are illustrated for purposes of example, it is contemplated thatany suitable number of services may be used with the service-orientedsystem. The services 110A-110N may be designed for implementation usinga plurality of hosts, any of which may be implemented by the examplecomputing device 3000 illustrated in FIG. 28. The hosts may be locatedin any suitable number of data centers or geographical locations. In oneembodiment, multiple services and/or instances of the same service maybe implemented using the same host. It is contemplated that theservice-oriented system and/or optimization system 1050 may includeadditional components not shown, fewer components than shown, ordifferent combinations, configurations, or quantities of the componentsshown.

Each service 110A-110N may be configured to perform one or morefunctions upon receiving a suitable request. For example, a service maybe configured to retrieve input data from one or more storage locationsand/or from a service request, transform or otherwise process the data,and generate output data. In some cases, a first service may call asecond service, the second service may call a third service to satisfythe request from the first service, and so on. For example, to build aweb page dynamically, numerous services may be invoked in a hierarchicalmanner to build various components of the web page. In some embodiments,services may be loosely coupled in order to minimize (or in some caseseliminate) interdependencies among services. This modularity may enableservices to be reused in order to build various applications through aprocess referred to as orchestration. A service may include one or morecomponents that may also participate in the service-oriented system,e.g., by passing messages to other services or to other componentswithin the same service.

The service-oriented system including the services 110A-110N may beconfigured to process requests from various internal or externalsystems, such as client computer systems or computer systems consumingnetworked-based services (e.g., web services). For instance, an end-useroperating a web browser on a client computer system may submit a requestfor data (e.g., data associated with a product detail page, a shoppingcart application, a checkout process, search queries, etc.). In anotherexample, a computer system may submit a request for a web service (e.g.,a data storage service, a data query, etc.). In general, services may beconfigured to perform any of a variety of business processes.

The services 110A-110N described herein may include but are not limitedto one or more of network-based services (e.g., a web service),applications, functions, objects, methods (e.g., objected-orientedmethods), subroutines, or any other set of computer-executableinstructions. In various embodiments, such services may communicatethrough any of a variety of communication protocols, including but notlimited to the Simple Object Access Protocol (SOAP). In variousembodiments, messages passed between services may include but are notlimited to Extensible Markup Language (XML) messages or messages of anyother markup language or format. In various embodiments, descriptions ofoperations offered by one or more of the services may include WebService Description Language (WSDL) documents, which may in some casesbe provided by a service broker accessible to the services andcomponents. References to services herein may include components withinservices.

As discussed with reference to FIG. 1, each of the services 110A-110Nmay be configured with one or more components for monitoringinteractions between services. The interaction monitoring functionalityfor each service may monitor or track interactions between thecorresponding service and other services (or components of services) inthe service-oriented system. The monitored interactions may includeservice requests (i.e., requests for services to be performed),responses to requests, and other suitable events. In one embodiment, theinteraction monitoring functionality may monitor service interactionssuch as service requests and service responses in any suitableenvironment, such as a production environment and/or a test environment.To monitor the service requests and responses, lightweightinstrumentation may be added to services. The instrumentation (e.g., areporting agent associated with each service) may collect and reportdata associated with each inbound request, outbound request, or otherservice interaction (e.g., a timer-based interaction) processed by aservice. As discussed above with respect to FIG. 1, a service maycollect trace data and send the trace data to the optimization system1050. The trace data may describe aspects of the service interactions.Further aspects of the interaction monitoring functionality arediscussed below with respect to FIG. 21 through FIG. 26.

In one embodiment, the optimization system 1050 may include a pluralityof components configured for optimization of a service-oriented system.For example, the optimization system 1050 may include a cross-servicestatic analysis functionality 1060 and an optimizer functionality 180.In some embodiments, the optimization system 650 may also include aperformance analysis functionality 160 as shown in FIG. 1 and/or a dataflow analysis functionality 170 as shown in FIG. 6A. The optimizationsystem 1050 may include one or more computing devices, any of which maybe implemented by the example computing device 3000 illustrated in FIG.28. In various embodiments, the functionality of the different services,components, and/or modules of the optimization system 1050 may beprovided by the same computing device or by different computing devices.If any of the various components are implemented using differentcomputing devices, then the respective computing devices may becommunicatively coupled, e.g., via a network. Each one of thecross-service static analysis functionality 1060 and the optimizerfunctionality 180 may represent any combination of software and hardwareusable to perform their respective functions, as discussed as follows.

Using the cross-service static analysis functionality 1060, theoptimization system 1050 may analyze the program code of multipleservices (e.g., services 110A-110N) and optimize a service-orientedsystem including those services based on the analysis. In general, thecross-service static analysis functionality 1060 may determineproperties of call patterns before services are executed. For example,the cross-service static analysis functionality 1060 may detect one ormore service dependencies in the program code of various services. Inone embodiment, any of the services 110A-110N may be programmed with oneor more service dependencies. For example, service 110A may include oneor more service dependencies 111A, service 110B may include one or moreservice dependencies 111B, and service 110N may include one or moreservice dependencies 111N. The service dependencies may include servicecalls or other invocations of the functionality of other services, forexample. The service code 1010 may be expressed in any suitableprogramming language(s). The service dependencies may be represented inthe service code 1010 by any suitable programming language element(s),such as calls to an interface to invoke the functionality of otherservices.

By using the cross-service static analysis functionality 1060 to detectone or more service dependencies 111A-111N, the optimization system 1050may generate an optimized configuration that takes advantage of theservice dependencies to improve the performance and/or cost of theservice-oriented system. In various embodiments, various types ofoptimizations may be implemented. For example, services withdependencies may be colocated to improve resource usage (e.g., networkusage, memory usage, and/or processor usage). As discussed above, two ormore services may be colocated to the same zone, the same host, the sameprocess, or the same virtual machine. Similarly, the number of deployedinstances of a service may be modified based on the static analysis. Asanother example, optimized versions of services may be generated bymodifying the relevant portions of the service code 1010 prior todeployment of services. In one embodiment, an optimized service may begenerated that includes at least a portion of a first service and atleast a portion of a second service, where a service dependency betweenthe first and second services was detected using the cross-servicestatic analysis 1060. For example, a first service may be optimized tobring program code from a second service inline, thus improving resourceusage. Furthermore, the cross-service static analysis 1060 may be usedto compile the program code for multiple services together or atsubstantially the same time in order to optimize one or more of theservices. By determining that some portions of code are never reachedusing static analysis, a service may be partially deployed to aparticular context. By compiling services together, errors involved withservice calls may be determined and addressed. Additionally,cross-service static analysis may be used to ensure the security of datapassed from one service to another.

In general, suitable ones of the service-oriented system optimizationsdescribed herein may be based at least in part on the cross-servicestatic analysis. For example, runtime analysis using trace data (e.g.,using the performance analysis functionality 160 as shown in FIG. 1and/or the data flow analysis functionality 170 as shown in FIG. 6A) maybe augmented with the use of cross-service static analysis. Inparticular, the static analysis may determine which services are calledby a service in order to restrict the scope of the runtime analysis.Furthermore, services may be optimized or deployed based on thecross-service static analysis, and that optimization or deployment maybe refined with the use of runtime data collected after deployment.

Using the optimizer functionality 180, the optimization system 150 maydetermine an optimized configuration 185 for at least a portion of theservice-oriented system. As used herein, the term “optimized” generallymeans “improved” rather than “optimal.” The optimized configuration 185for a set of services may represent an improvement on the existingconfiguration of the set of services with respect to one or moreperformance metrics (e.g., network latency or transit times, throughput,reliability or availability, cost, etc.) for at least a portion of theone or more call graphs. Accordingly, the optimized configuration 185may be determined based on the static analysis 1060 and optionally basedon one or more performance metrics in order to optimize one or more callpaths of the one or more call graphs. In one embodiment, the optimizedconfiguration 185 may also be determined based on additional informationthat is not derived from trace data, such as an expense associated witheach service instance, service interaction, host, and/or unit ofresource consumption. In one embodiment, the optimized configuration 185may be determined such that it minimizes, maximizes, decreases, orincreases a total performance metric for one or more call paths. Forexample, the optimized configuration 185 may minimize or reduce thenetwork latency for one or more call paths, maximize or increase thethroughput for one or more call paths, maximize or increase thereliability or availability for one or more call paths, or minimize orreduce the cost for one or more call paths. The optimizer 180 may takeinto account the sensitivity of a particular call path to latency, e.g.,whether improving the latency of one event would improve the latency ofanother event in a call graph. Any suitable component(s) may be used toimplement the optimizer 180. For example, the optimizer 180 may beimplemented using a constrained optimization solver which is configuredto minimize a cost function or an energy function in the presence of oneor more constraints or to maximize a reward function or a utilityfunction in the presence of one or more constraints. The optimizer 180may generate an optimized configuration 185 by optimizing a user-definedfunction of network latency, throughput, reliability, cost, and/or anyother suitable term(s).

In one embodiment, the optimization system 1050 may generate and/ormodify the optimized configuration 185 repeatedly and at appropriateintervals. Similarly, the placement of services may be modifiedrepeatedly and at appropriate intervals in accordance with new ormodified versions of the optimized configuration 185. In one embodiment,the optimized configuration 185 for one or more services may begenerated periodically, such as when a software deployment occurs orwhen a traffic analysis is performed. In one embodiment, the optimizedconfiguration 185 may be generated to optimize the use of any suitablecomputational resources, such as processor resources, memory resources,and/or network resources.

FIG. 11A illustrates an example of service-oriented system optimizationusing cross-service static analysis, according to some embodiments. Asdiscussed above, the cross-service static analysis functionality 1060may detect one or more service dependencies in the program code ofvarious services. For example, the cross-service static analysisfunctionality 1060 may analyze the program code 1110 for a set ofservices, e.g., service 110A, service 110B, service 110C, service 110D,and service 110E. The service dependencies detected by the cross-servicestatic analysis functionality 1060 may include service calls or otherinvocations of the functionality of other services, for example. In theexample shown in FIG. 11A, the cross-service static analysisfunctionality 1060 may determine, based on the service code 1110, thatcalls from service 110A to service 110B result in service 110B callingservice 110D but not service 110E. Similarly, the cross-service staticanalysis functionality 1060 may determine, based on the service code1110, that calls from service 110C to service 110B result in service110B calling service 110E but not service 110D.

By using the cross-service static analysis functionality 1060 to detectone or more service dependencies, the optimization system 1050 maygenerate an optimized configuration that takes advantage of the servicedependencies to improve the performance and/or cost of theservice-oriented system. Accordingly, based on the service dependenciesdetermined above, instances of the services may be colocated to improveresource usage (e.g., network usage, memory usage, and/or processorusage). As discussed above, two or more services may be colocated to thesame zone, the same host, the same process, or the same virtual machine.To take advantage of the service dependencies between services 110A,110B, and 110D, instances of all three services may be deployed to thesame zone 1105, for example. The zone 1105 may represent a geographicalarea, a data center, or a particular location (e.g., a rack) within adata center. Alternatively, instances of all three services 110A, 110B,and 110D may be deployed to the same host or same virtual machine.Similarly, to take advantage of the service dependencies betweenservices 110C, 110B, and 110E, instances of all three services may bedeployed to the same zone 1106, for example. Again, the zone 1106 mayrepresent a geographical area, a data center, or a particular location(e.g., a rack) within a data center. Alternatively, instances of allthree services 110C, 110B, and 110E may be deployed to the same host orsame virtual machine. In this manner, services that tend to call otherservices may be deployed near each other in a service-oriented system1100 in order to improve resource usage, cost, and/or performance in atleast a portion of the service-oriented system 1100.

FIG. 11B illustrates an example of service-oriented system optimizationusing cross-service static analysis, according to some embodiments. Asdiscussed above, the cross-service static analysis functionality 1060may detect one or more service dependencies in the program code ofvarious services. For example, the cross-service static analysisfunctionality 1060 may analyze the program code 1160 for a set ofservices, e.g., service 110A, service 110B, and service 110C. Theservice dependencies detected by the cross-service static analysisfunctionality 1060 may include service calls or other invocations of thefunctionality of other services, for example. In the example shown inFIG. 11B, the cross-service static analysis functionality 1060 maydetermine, based on the service code 1160, that calls from service 110Ato service 110B result in a particular set of results being returnedfrom service 110B to service 110A. The cross-service static analysisfunctionality 1060 may also determine, based on the service code 1160,that calls from service 110C to service 110B result in a particular setof results being returned from service 110B to service 110C.

By using the cross-service static analysis functionality 1060 to detectone or more service dependencies, the optimization system 1050 maygenerate an optimized configuration that takes advantage of the servicedependencies to improve the performance and/or cost of theservice-oriented system. Accordingly, based on the service dependenciesdetermined above, instances of the services may be deployed withsuitable tables of results of caches of results to improve resourceusage (e.g., network usage, memory usage, and/or processor usage). Totake advantage of the service dependencies between services 110A and110B, service 110A may be deployed not with an instance of service 110Bbut with a table of results 112B from service 110B, where the potentialresults in the table 112B were determined using the cross-service staticanalysis. Accordingly, if only the results in the table 112B arepossible when service 110A calls service 110B, the instance of service110A may be deployed without the ability to make a service call toservice 110B but instead to rely upon the table of results 112B.Similarly, to take advantage of the service dependencies betweenservices 110C and 110B, service 110C may be deployed with cache 113Bthat includes a table of results from service 110B, where the potentialresults in the cache 113B were determined using the cross-service staticanalysis. However, if the cross-service static analysis determines thatother results are possible, then service 110C may also be deployed withan instance of 110B, and service 110C may call service 110B only if acache miss is encountered. In this manner, services that tend to callother services may be deployed with caches or tables in aservice-oriented system 1150 in order to improve resource usage, cost,and/or performance in at least a portion of the service-oriented system1150. In general, the cross-service static analysis may also be used todetermine cache size, cache location, and cache policy for aservice-oriented system.

FIG. 12A is a flowchart illustrating a method for service-orientedsystem optimization using cross-service static analysis, according tosome embodiments. As shown in 1205, a cross-service static analysis ofprogram code may be performed for services in a service-oriented system.As shown in 1210, one or more service dependencies may be determined inthe program code for the services. The service dependencies may bedetermined based on the cross-service static analysis. The servicedependencies may include one or more service calls between services.

As shown in 1215, an optimized configuration may be determined for theservice-oriented system based on the one or more service dependencies.The optimized configuration may improve a total performance metric in atleast a portion of the service-oriented system. As shown in 1220,services may be deployed to the service-oriented system based on theoptimized configuration. By deploying services based on the optimizedconfiguration, services may be colocated to take advantage of servicedependencies detected using cross-service static analysis. Additionally,optimized services may be generated and deployed to take advantage ofservice dependencies detected using cross-service static analysis.Furthermore, caches of results and/or tables of results may be deployedbetween services to take advantage of service dependencies detectedusing cross-service static analysis.

FIG. 12B is a flowchart illustrating a method for service-orientedsystem optimization using cross-service static analysis, includingcollocation of services, according to some embodiments. As shown in1205, a cross-service static analysis of program code may be performedfor services in a service-oriented system. As shown in 1210, one or moreservice dependencies may be determined in the program code for theservices. The service dependencies may be determined based on thecross-service static analysis. The service dependencies may include oneor more service calls between services.

As shown in 1216, an optimized configuration may be determined for theservice-oriented system based on the one or more service dependencies.The optimized configuration may improve a total performance metric in atleast a portion of the service-oriented system. The optimizedconfiguration may also include a colocation of two or more services. Forexample, if the cross-service static analysis indicates that one servicefrequently calls another service, then an optimized configuration mayinclude colocation for the two services. The colocation may be withinthe same zone, the same host, the same process, or the same virtualmachine. As shown in 1221, services may be deployed to theservice-oriented system based on the optimized configuration, includingthe colocation. By deploying services based on the optimizedconfiguration, services may be colocated to take advantage of servicedependencies detected using cross-service static analysis.

FIG. 12C is a flowchart illustrating a method for service-orientedsystem optimization using cross-service static analysis, includinggeneration of optimized services, according to some embodiments. Asshown in 1205, a cross-service static analysis of program code may beperformed for services in a service-oriented system. As shown in 1210,one or more service dependencies may be determined in the program codefor the services. The service dependencies may be determined based onthe cross-service static analysis. The service dependencies may includeone or more service calls between services.

As shown in 1215, an optimized configuration may be determined for theservice-oriented system based on the one or more service dependencies.The optimized configuration may improve a total performance metric in atleast a portion of the service-oriented system. As shown in 1217, one ormore optimized services may be generated based on the servicedependencies. For example, one or more optimized services may begenerated by compiling the services together or otherwise modifying theservices to take advantage of the service dependencies. As anotherexample, code from one service may be pulled inline to another servicein place of a service call. As shown in 1222, services may be deployedto the service-oriented system based on the optimized configuration,including the optimized service(s). Accordingly, optimized services maybe generated and deployed to take advantage of service dependenciesdetected using cross-service static analysis.

Global Optimization

FIG. 13 illustrates an example system environment for globaloptimization of a service-oriented system, according to someembodiments. The example system environment may include aservice-oriented system 100 and an optimization system 1350. Theservice-oriented system 100 may implement a service-orientedarchitecture and may include multiple services 110A-110N configured tocommunicate with each other (e.g., through message passing) to carry outvarious tasks, such as business functions. Although two services 110Aand 110N are illustrated for purposes of example, it is contemplatedthat any suitable number of services may be used with theservice-oriented system 100. The services 110A-110N may representdifferent services (e.g., different sets of program code) or differentinstances of the same service. The services 110A-110N may be implementedusing a plurality of hosts, any of which may be implemented by theexample computing device 3000 illustrated in FIG. 28. The hosts may belocated in any suitable number of data centers or geographicallocations. In one embodiment, multiple services and/or instances of thesame service may be implemented using the same host. It is contemplatedthat the service-oriented system 100 and/or optimization system 1350 mayinclude additional components not shown, fewer components than shown, ordifferent combinations, configurations, or quantities of the componentsshown.

Each service 110A-110N may be configured to perform one or morefunctions upon receiving a suitable request. For example, a service maybe configured to retrieve input data from one or more storage locationsand/or from a service request, transform or otherwise process the data,and generate output data. In some cases, a first service may call asecond service, the second service may call a third service to satisfythe request from the first service, and so on. For example, to build aweb page dynamically, numerous services may be invoked in a hierarchicalmanner to build various components of the web page. In some embodiments,services may be loosely coupled in order to minimize (or in some caseseliminate) interdependencies among services. This modularity may enableservices to be reused in order to build various applications through aprocess referred to as orchestration. A service may include one or morecomponents that may also participate in the service-oriented system,e.g., by passing messages to other services or to other componentswithin the same service.

The service-oriented system 100 may be configured to process requestsfrom various internal or external systems, such as client computersystems or computer systems consuming networked-based services (e.g.,web services). For instance, an end-user operating a web browser on aclient computer system may submit a request for data (e.g., dataassociated with a product detail page, a shopping cart application, acheckout process, search queries, etc.). In another example, a computersystem may submit a request for a web service (e.g., a data storageservice, a data query, etc.). In general, services may be configured toperform any of a variety of business processes.

The services 110A-110N described herein may include but are not limitedto one or more of network-based services (e.g., a web service),applications, functions, objects, methods (e.g., objected-orientedmethods), subroutines, or any other set of computer-executableinstructions. In various embodiments, such services may communicatethrough any of a variety of communication protocols, including but notlimited to the Simple Object Access Protocol (SOAP). In variousembodiments, messages passed between services may include but are notlimited to Extensible Markup Language (XML) messages or messages of anyother markup language or format. In various embodiments, descriptions ofoperations offered by one or more of the services may include WebService Description Language (WSDL) documents, which may in some casesbe provided by a service broker accessible to the services andcomponents. References to services herein may include components withinservices.

In one embodiment, each of the services 110A-110N may be configured withone or more components for monitoring interactions between services. Forexample, service 110A may include an interaction monitoringfunctionality 120A, and service 110N may include an interactionmonitoring functionality 120N. The interaction monitoring functionality120A or 120N may monitor or track interactions between the correspondingservice 110A or 110N and other services (or components of services) inthe service-oriented system 100. The monitored interactions may includeservice requests 125A-125N (i.e., requests for services to beperformed), responses 126A-126N to requests, and other suitable events.

In one embodiment, the interaction monitoring functionality 120A or 120Nmay monitor service interactions such as service requests 125A or 125Nand service responses 126A or 126N in any suitable environment, such asa production environment and/or a test environment. The productionenvironment may be a “real-world” environment in which a set ofproduction services are invoked, either directly or indirectly, byinteractions with a real-world client, consumer, or customer, e.g., ofan online merchant or provider of web-based services. In one embodiment,the test environment may be an environment in which a set of testservices are invoked in order to test their functionality. The testenvironment may be isolated from real-world clients, consumers, orcustomers of an online merchant or provider of web-based services. Inone embodiment, the test environment may be implemented by configuringsuitable elements of computing hardware and software in a mannerdesigned to mimic the functionality of the production environment. Inone embodiment, the test environment may temporarily borrow resourcesfrom the production environment. In one embodiment, the test environmentmay be configured to shadow the production environment, such thatindividual test services represent shadow instances of correspondingproduction services. When the production environment is run in shadowmode, copies of requests generated by production services may beforwarded to shadow instances in the test environment to execute thesame transactions.

To monitor the service requests 125A-125N and responses 126A-126N,lightweight instrumentation may be added to services, including services110A-110N. The instrumentation (e.g., a reporting agent associated witheach service) may collect and report data associated with each inboundrequest, outbound request, or other service interaction (e.g., atimer-based interaction) processed by a service. Further aspects of theinteraction monitoring functionality 120A-120N are discussed below withrespect to FIG. 21 through FIG. 26.

Based on the interaction monitoring, a service may collect trace dataand send the trace data to the optimization system 1350. For example,service 110A may collect and send trace data 130A, and service 110N maycollect and send trace data 130N. The trace data may describe aspects ofthe service interactions. In one embodiment, the trace data may begenerated in real-time or near real-time, e.g., as service requests andservice responses are received and/or processed by the services. Thetrace data may include data indicative of relationships betweenindividual services, such as an identification of the calling (i.e.,requesting) service and the called (i.e., requested) service for eachinteraction. The trace data may include metadata such as requestidentifiers that are usable to identify paths of service requests andresponses from service to service. Request identifiers are discussed ingreater detail below with respect to FIG. 21 through FIG. 26. The tracedata may also include data describing the performance of the serviceinteractions. For example, the trace data may include data indicative ofnetwork latency for a request or response, data indicative of networkthroughput for one or more interactions, data indicative of servicereliability or availability, data indicative of resource usage, etc. Thetrace data generated for multiple services and multiple serviceinteractions may be sent to the optimization system 150 for aggregationand analysis.

In one embodiment, the optimization system 1350 may include a pluralityof components configured for analysis of the trace data 130A-130N andoptimization of the service-oriented system 100 based on the analysis.For example, the optimization system 1350 may include a performanceanalysis functionality 160, a cost analysis functionality 161, a dataflow analysis functionality 170, and an optimizer functionality 180. Theoptimization system 1350 may include one or more computing devices, anyof which may be implemented by the example computing device 3000illustrated in FIG. 28. In various embodiments, the functionality of thedifferent services, components, and/or modules of the optimizationsystem 1350 may be provided by the same computing device or by differentcomputing devices. If any of the various components are implementedusing different computing devices, then the respective computing devicesmay be communicatively coupled, e.g., via a network. Each one of theperformance analysis functionality 160, the cost analysis functionality161, the data flow analysis functionality 170, and the optimizerfunctionality 180 may represent any combination of software and hardwareusable to perform their respective functions, as discussed as follows.

Using the performance analysis functionality 160, the optimizationsystem 1350 may analyze the performance data generated by theinteraction monitoring functionality 120A-120N and received by theoptimization system 1350 in the trace data 130A-130N. The performanceanalysis functionality 160 may determine one or more performance metrics165 based on the trace data 130A-130N. In one embodiment, theperformance metrics 165 may describe aspects of the performance ofmultiple interactions, such as metrics representing aggregateperformance, average performances, etc. In one embodiment, theperformance metrics 165 may describe aspects of the performance ofindividual interactions. For example, the optimization system 1350 maycalculate the client-measured latency for an interaction based on thetime at which a request was sent by a service and also on the time atwhich a response to the request was received by the service. Theoptimization system 1350 may also calculate the server-measured latencyfor an interaction based on the time at which a request was received bya service and also on the time at which a response to the request wassent by the service. The network transit time for the interaction may becalculated as the difference between the client-measured latency and theserver-measured latency. Accordingly, the performance metrics 165 mayinclude individual transit times for individual service calls and/ortransit time metrics (e.g., mean, median, etc.) for multiple servicecalls. Network transit times may be impacted by the number of networkhops, the physical distance between hops, and the link quality betweenendpoints.

The interaction monitoring functionality 120A-120N for the variousservices may collect data indicative of service interactions involved insatisfying a particular initial request, e.g., data indicative of aroute taken in satisfying a service request and/or a hierarchy of callpathways between services. The route may correspond to a set of callpaths between services. The call paths may represent inbound servicerequests and outbound service requests relative to a particular service.To process a given received request, one or more services may beinvoked. As used herein, an initial request may be referred to as the“root request.” In various embodiments, the root request may but neednot originate from a computer system outside of the service-orientedsystem 100. In many embodiments, a root request may be processed by aninitial service, which may then call one or more other services.Additionally, each of those services may also call one or more otherservices, and so on until the root request is completely fulfilled. Theparticular services called to fulfill a request may be represented as acall graph that specifies, for each particular service of multipleservices called to fulfill the same root request, the service thatcalled the particular service and any services called by the particularservice.

Using the cost analysis functionality 161, the optimization system 1350may estimate the costs of deploying and/or operating various elements ofthe service-oriented system 100. For example, the cost analysisfunctionality 161 may determine cost metrics 166 related to deployingand/or operating particular hosts, classes of hosts, services, classesof services, etc. Each cost metric may include one or more costvaluations, such as a total cost of ownership (TCO), a capitalexpenditure, and/or any other suitable cost valuation with or without atime component. Additionally, the cost metrics 166 may include costs forelements of computing resource usage (e.g., processor usage, persistentstorage usage, memory usage, etc.), energy consumption, heat production,and/or any other suitable cost element(s). In one embodiment, the costsof various configuration parameters may also be determined by the costanalysis functionality 161. For example, the costs of potentiallyenabling varying types of caches in varying locations and with varyingsizes and varying policies may be determined by the cost analysisfunctionality 161. As further examples, the costs of enablingconfiguration parameters for data locations, service parallelization,and response precomputation may be determined by the cost analysisfunctionality 161. In one embodiment, the performance metrics 165 mayalso influence aspects of the cost metrics 166. The cost metrics 166 maybe initially determined statically and updated dynamically as costschange through the lifespan of elements of the service-oriented system100.

In one embodiment, the cost analysis functionality 161 may determine thecosts of computations in the service-oriented system 100. Over thecourse of runtime traffic, the optimization system 1350 may collect dataabout which computations are run and over which inputs. For everycomputation, the cost analysis functionality 161 may determine howexpensive it is. For every computation, the cost analysis functionality161 may also determine the number of repeated invocations of thecomputation within some domain of execution. The cost analysisfunctionality 161 may multiply the cost per computation by the number ofinvocations to determine the total cost of the computation within aparticular context (as determined by call patterns in trace data) andperiod of time.

Using the data flow analysis functionality 170, the optimization system1350 may analyze the trace data 130A-130N and generate one or more callgraphs 175 based on connectivity information within the trace data. Eachcall graph may represent the flow of requests from service to serviceand may identify service dependencies. Each call graph may include aplurality of nodes representing services and one or more edges (alsoreferred to as call paths) representing service interactions. Each ofthe call graphs 175 may include a hierarchical data structure thatinclude nodes representing the services and edges representing theinteractions. In some cases, a call graph may be a deep and broad treewith multiple branches each representing a series of related servicecalls. The data flow analysis functionality 170 may use any suitabledata and metadata to build each call graph, such as request identifiersand metadata associated with services and their interactions. Therequest identifiers and metadata are discussed below with respect toFIG. 21 through FIG. 26. In one embodiment, the data flow analysisfunctionality 170 may analyze the trace data 130A-130N and generatesuitable reports and/or visualizations (e.g., call graph visualizations)based on the trace data 130A-130N.

The generation of a particular call graph may be initiated based on anysuitable determination. In one embodiment, the call graph generation maybe initiated after a sufficient period of time has elapsed with nofurther service interactions made for any relevant service. In oneembodiment, heuristics or other suitable rule sets may be used todetermine a timeout for a lack of activity to satisfy a particular rootrequest. The timeout may vary based on the nature of the root request.For example, a root request to generate a web page using a hierarchy ofservices may be expected to be completed within seconds; accordingly,the call graph may be finalized within seconds or minutes.

Using the optimizer functionality 180, the optimization system 1350 maydetermine one or more optimizations for the service-oriented system 100.In general, the optimizer may determine local optimizations oroptimizations in particular elements or classes of elements based onglobal data for the service-oriented system 100. As used herein, theterm “optimized” generally means “improved” rather than “optimal.” Theoptimization(s) may be determined as part of an optimized configurationthat improves at least one performance metric and/or at least one costacross at least a portion of the service-oriented system 100. Using thecost metrics 166 for potential configuration options along with theperformance metrics 165 and optionally the call graph(s) 175, theoptimizer 180 may select one or more configuration parameters. Theoptimizer 180 may select the one or more configuration parameters (e.g.,select values for the parameters) from a set of configuration parametersand a set of candidate values for each configuration parameter. Theconfiguration parameters may relate to the operation of any suitableservices, hosts, and/or other components that are sought to beoptimized. In one embodiment, the search domain (e.g., the configurationparameters and candidate values) may be defined based on input from auser. In one embodiment, the search domain may be defined based onautomatic and/or programmatic discovery of various configurable elementsof services, hosts, and/or other components.

In one embodiment, the optimizer 180 may determine an optimized cacheconfiguration 187 for one or more caches in the service-oriented system100 by selecting suitable values for cache configuration options. Forexample, the optimizer 180 may determine an optimized cache location byselecting one or more cache location options. As another example, theoptimizer 180 may determine an optimized cache size by selecting one ormore cache location sizes. As a further example, the optimizer 180 maydetermine an optimized cache policy by selecting one or more cachepolicy options. Similarly, the optimizer 180 may determine an optimizedcache type by selecting one or more cache type options.

Based on the total cost for a computation, the optimization system 1350may determine, for example, how large of a cache and/or how expensive ofa cache may be used in association with the computation. Because theoptimization may be based on call patterns between various services, anoptimization decision made for one pair of services may differ from anoptimization decision made for one pair of services, even when one ofthe services is the same. In one embodiment, the optimization system1350 may determine that service calls across different services arerelated to a common request, and the optimization system 1350 mayidentify and/or configure caches for those services to have an affinityfor that common request. In one embodiment, the optimization system 1350may ensure that caches are maintained for the life cycle of such arequest, for the consistency of the caches. In one embodiment, theoptimization system 1350 may enable caching in areas where caching wouldnot incur any additional staleness of data. Additionally, static datamay be used to augment the determination of the optimized cacheconfiguration 187.

In one embodiment, the optimizer 180 may determine an optimized datalocation 188 for one or more data sources in the service-oriented system100 by selecting suitable values for data location options. Byconfiguring data locations in this manner, data sources may be linked todata consumers in an optimized manner. For example, the type of storage(e.g., transient or persistent), the number of storage locations, andthe proximity of the storage location(s) may be determined to meet theneeds of a particular data consumer. Additionally, the optimizer 180 maydetermine how and when to optimize batch accumulation for service callsto a remote node.

In one embodiment, the optimizer 180 may determine an optimized serviceparallelization 189 for one or more sets of services in theservice-oriented system 100 by selecting suitable values for serviceparallelization options. Service parallelization options may includedifferent numbers of service instances and potentially differentlocations for those instances. By using global data to influence serviceparallelization, the optimizer 180 may optimize along differentdimensions such as low latency, consistency of throughput, maximalutilization of CPU or memory or network resources, availability. Inoptimizing service parallelization, the optimizer 180 may determine abalance between various trade-offs in the service-oriented system 100.For example, for a request including a quantity M of parallelizableelements of work, where each element of work includes a quantity N ofinstructions that are also parallelizable, the optimizer may distributethe M*N instructions among any suitable number of parallelized paths onany suitable number of hosts, where each path may include serializedinstructions. The distribution of parallelized paths and serializedinstructions may be determined (at least in part) based on costanalysis. As another example of a trade-off, a set of X*Y parallelizableinstructions may be broken into X parallelized chunks of Y serializedinstructions based on cost constraints for the parallelized chunks. Inthis manner, service parallelization may be automatically tuned in aservice-oriented system.

In one embodiment, the optimizer 180 may determine an optimized responseprecomputation 190 for one or more services in the service-orientedsystem 100 by selecting suitable values for response precomputationoptions. For example, trace data may be used to determine the entitiesthat are being looked up frequently and/or recognize patterns inresponses. Accordingly, the optimizer 180 may determine when toprecompute elements of data for particular entities. Similarly, tracedata may be used to determine when to do speculative execution or whento reorder a sequence of steps. In general, precomputation may involvedoing a computation “eagerly” rather than “lazily.” For example, if acomputation involves multiplying A and B to produce C, then a “lazy”computation might involve looking up A when the computation isrequested, looking up B when the computation is requested, and thencomputing C. However, if the optimizer 180 determines that clientsfrequently want to know the value of C, then the optimizer may configurethe service-oriented system such that whenever A or B changes, thesystem may automatically precompute C (in anticipation of a clientseeking C in the future) and store the updated value of C.

Any suitable component(s) may be used to implement the optimizer 180.For example, the optimizer 180 may be implemented using a constrainedoptimization solver which is configured to minimize a cost function oran energy function in the presence of one or more constraints or tomaximize a reward function or a utility function in the presence of oneor more constraints. The optimizer 180 may generate any of theoptimizations 187, 188, 189, or 190 by optimizing a user-definedfunction of network latency, throughput, reliability, cost, and/or anyother suitable term(s).

In one embodiment, data and/or metadata associated with a request orresponse may be compressed, encrypted, or serialized by a service.Similarly, data and/or metadata associated with a request or responsemay be decompressed, decrypted, or deserialized upon receipt by aservice. The cost or time associated with compression, decompression,encryption, decryption, serialization, and/or deserialization may betaken into account by the optimizer 180. Accordingly, performancemetrics associated with the costs of preparing a message for networktransport and processing such a received message (e.g., the costs ofcompression, decompression, encryption, decryption, serialization,and/or deserialization) may be collected as part of the trace data.Additionally, the optimizer 180 may take into account such performancedata as CPU (central processing unit) utilization for program code,memory utilization for program code, and any other suitable data. In oneembodiment, the optimization system 150 may collect performance datafrom sources other than the interaction monitoring components.

In one embodiment, all or nearly all of the service interactions (e.g.,the service requests 125A-125N and service responses 126A-126N) may bemonitored to generate trace data 130A-130N for use with the optimizationsystem 150. In one embodiment, however, only a subset of the serviceinteractions (e.g., service requests 125A-125N and service responses126A-126N) may be monitored to generate trace data 130A-130N for usewith the optimization system 150. Any suitable technique may be used toidentify which of the service interactions are collected and/or used asthe basis for the optimized configuration. For example, probabilisticsampling techniques may be used to initiate interaction monitoring for acertain percentage (e.g., 1%) of all service interactions.

In one embodiment, the optimization system 1350 may receive a continuousstream of trace data from the service-oriented system 100. Theoptimization system 1350 may generate and/or modify the optimizedconfiguration (including any of the optimizations 187, 188, 189, or 190)repeatedly and at appropriate intervals. Similarly, the deployment ofelements based on the optimizations 187, 188, 189, or 190 may bemodified repeatedly and at appropriate intervals in accordance with newor modified versions of the optimized configuration.

FIG. 14 illustrates further aspects of an example system environment forglobal optimization of a service-oriented system, according to someembodiments. A service-oriented system 1400 may implement aservice-oriented architecture and may include a variety of differenttypes of components. In one embodiment, the service-oriented system 1400may include a plurality of services such as services 110A and 110Bthrough 110N. In one embodiment, the service-oriented system 1400 mayinclude a plurality of caches 1410 such as caches 1410A and 1410Bthrough 1410N. In one embodiment, the service-oriented system 1400 mayinclude a plurality of data sources 1430 such as caches 1430A and 1430Bthrough 1430N. The services 110, caches 1410, and data sources 1430 maybe implemented using any suitable number of hosts as well as anysuitable memory resources, storage resources, processing resources, andnetwork resources. In one embodiment, individual hosts may be added toor subtracted from the service-oriented system 1400, e.g., based on thecomputing resources required to run a particular set of services with adesired level of performance. Each host may run one or more services. Itis contemplated that the service-oriented system 1400 and/oroptimization system 1350 may include additional components not shown,fewer components than shown, or different combinations, configurations,or quantities of the components shown.

In one embodiment, a suitable component of the service-oriented system1400 may provision and/or configure the hosts, services 110, caches1410, and data sources 1430. For example, the hosts may be provisionedfrom a pool of available compute instances by selecting availablecompute instances with suitable specifications and configuring theselected compute instances with suitable software. In one embodiment,additional compute instances may be added to the service-oriented system1400 as needed. In one embodiment, compute instances may be returned tothe pool of available compute instances from service-oriented system1400, e.g., if the computing instances are not needed at a particularpoint in time. Additionally, the software installed on the hosts may bemodified. A configuration controller 1420 may implement such aprovisioning and configuration functionality (potentially in conjunctionwith other components) to cause one or more hosts to be added to theservice-oriented system 1400, cause one or more hosts to be removed fromthe service-oriented system 1400, cause one or more services to beremoved from one or more hosts, and/or cause one or more services to beadded to one or more hosts. The configuration controller 1420 may alsoimplement any configuration changes for the services 110, caches 1410,and data sources 1430. The configuration controller 1420 may beimplemented by the example computing device 3000 illustrated in FIG. 28and may be implemented as a physical compute instance or virtual computeinstance.

The number and/or configuration of the services 110, caches 1410, anddata sources 1430 may be modified in accordance with the optimizedconfiguration determined by the optimizer 180. In one embodiment, thenumber and/or configuration of the services 110, caches 1410, and datasources 1430 may be modified dynamically, e.g., while theservice-oriented system 1400 remains operational to serve requests. Inone embodiment, the optimization system 1350 may generate a globaloptimization plan 1386 based on the optimizations 187, 188, 189, and/or189 and send the plan to the configuration controller 1420. The globaloptimization plan 1386 may include an indication of the location(s) andconfiguration option(s) to be implemented for any of the services 110,caches 1410, and data sources 1430. In one embodiment, any of theservices 110, caches 1410, and data sources 1430 may be added, modified,or removed from the service-oriented system 1400 if the globaloptimization plan 1386 so indicates. In this manner, theservice-oriented system 1400 may be reconfigured to provide improvedperformance (e.g., improved transit times, throughput, or reliability)or to be implemented at an improved cost.

FIG. 15A illustrates an example of global optimization of aservice-oriented system, including cache optimization, according to someembodiments. A service-oriented system 1450 may implement aservice-oriented architecture and may include a plurality of hosts, anyof which may be implemented by the example computing device 3000illustrated in FIG. 28. The hosts may be coupled using one or morenetworks 230. Although three hosts 210A, 210B, and 210N are illustratedfor purposes of example, it is contemplated that any suitable number ofhosts may be used with the service-oriented system 1450. The hosts210A-210N may be located in any suitable number of data centers and/orgeographical locations. In one embodiment, individual hosts may be addedto or subtracted from the service-oriented system 1450, e.g., based onthe computing resources required to run a particular set of serviceswith a desired level of performance. Each host may run one or moreservices. For example, as shown in FIG. 15A, host 210A may run one ormore instances of service 110A, host 210B may run one or more instancesof service 110B, and host 210N may run one or more instances of service110N. In one embodiment, multiple services and/or instances of the sameservice may be implemented using the same host. It is contemplated thatthe service-oriented system 1450 and/or optimization system 1350 mayinclude additional components not shown, fewer components than shown, ordifferent combinations, configurations, or quantities of the componentsshown.

Based on the optimized cache configuration 187 determined by theoptimizer 180, one or more caches may be enabled and/or configured inthe service-oriented system 1450. As discussed with respect to FIG. 14,a configuration controller 1420 may implement a configurationfunctionality (potentially in conjunction with other components) toenable caches in various locations and/or change the configuration ofthe caches. As shown in the example of FIG. 15A, a cache 1410A may beenabled on host 210A with a particular configuration 1411A. Similarly, acache 1410N may be enabled on host 210N with a particular configuration1411N. In addition to varying in location, the caches 1410A and 1410Nmay vary in type, level, size, and/or policy, based on the optimizedcache configuration 187. The cache 1410A may be enabled within the sameprocess as the service 110A, or the cache 1410N may be enabled withinthe same process as the service 110N. In one embodiment, the use of acache (e.g., cache 1410A) may not be specified in the program code for aservice (e.g., service 110A) that is linked to the cache in the globaloptimization plan 1386.

FIG. 15B illustrates an example of global optimization of aservice-oriented system, including logical cache optimization, accordingto some embodiments. A service-oriented system 1460 may implement aservice-oriented architecture and may include a plurality of hosts, suchas hosts 210A, 210B, and 210N. Each host may run one or more services.For example, as shown in FIG. 15B, host 210A may run one or moreinstances of service 110A, host 210B may run one or more instances ofservice 110B, and host 210N may run one or more instances of service110N. It is contemplated that the service-oriented system 1460 and/oroptimization system 1350 may include additional components not shown,fewer components than shown, or different combinations, configurations,or quantities of the components shown.

Based on the optimized cache configuration 187 determined by theoptimizer 180, one or more caches may be enabled and/or configured inthe service-oriented system 1460. As discussed with respect to FIG. 14,a configuration controller 1420 may implement a configurationfunctionality (potentially in conjunction with other components) toenable caches in various locations and/or change the configuration ofthe caches. As shown in the example of FIG. 15B, a logical cache 1412may provide cached data from data source 1431 to a plurality ofservices. However, the services that use the logical cache 1412 may usedifferent configurations. For example, service 110A may use oneconfiguration 1413A for the logical cache 1412, and service 110N may usea different configuration 1413N for the logical cache 1412. Thedifferent cache configurations 1413A and 1413N may enable differentcache sizes, policies, or other configuration options. In oneembodiment, elements of the logical cache 1412 may be located on host210A, host 210N, and/or other locations. In one embodiment, the use of acache (e.g., cache 1412) may not be specified in the program code for aservice (e.g., service 110A or 110N) that is linked to the cache in theglobal optimization plan 1386.

FIG. 15C illustrates an example of global optimization of aservice-oriented system, including distributed cache optimization,according to some embodiments. A service-oriented system 1470 mayimplement a service-oriented architecture and may include a plurality ofhosts, such as hosts 210A, 210B, and 210N. Each host may run one or moreservices. For example, as shown in FIG. 15B, host 210A may run one ormore instances of service 110A, host 210B may run one or more instancesof service 110B, and host 210N may run one or more instances of service110N. It is contemplated that the service-oriented system 1470 and/oroptimization system 1350 may include additional components not shown,fewer components than shown, or different combinations, configurations,or quantities of the components shown.

Based on the optimized cache configuration 187 determined by theoptimizer 180, one or more caches may be enabled and/or configured inthe service-oriented system 1470. As discussed with respect to FIG. 14,a configuration controller 1420 may implement a configurationfunctionality (potentially in conjunction with other components) toenable caches in various locations and/or change the configuration ofthe caches. The caches may be distributed caches that are implementedusing a plurality of networked components. As shown in the example ofFIG. 15C, a distributed cache 1410A may be enabled for service 110A witha particular configuration 1411A. Similarly, a distributed cache 1410Nmay be enabled for service 110N with a particular configuration 1411N.The distributed cache 1410A may be located (at least partially) off ofhost 210A, and the distributed cache 1410N may be located (at leastpartially) off of host 210N. In addition to varying in location, thecaches 1410A and 1410N may vary in type, level, size, and/or policy,based on the optimized cache configuration 187. In one embodiment, theuse of a cache (e.g., cache 1410A) may not be specified in the programcode for a service (e.g., service 110A) that is linked to the cache inthe global optimization plan 1386.

FIG. 15D illustrates an example of global optimization of aservice-oriented system, including data location optimization, accordingto some embodiments. A service-oriented system 1490 may implement aservice-oriented architecture and may include a plurality of hosts, anyof which may be implemented by the example computing device 3000illustrated in FIG. 28. The hosts may be coupled using one or morenetworks 230. Although three hosts 210A, 210B, and 210N are illustratedfor purposes of example, it is contemplated that any suitable number ofhosts may be used with the service-oriented system 1490. The hosts210A-210N may be located in any suitable number of data centers and/orgeographical locations. In one embodiment, individual hosts may be addedto or subtracted from the service-oriented system 1490, e.g., based onthe computing resources required to run a particular set of serviceswith a desired level of performance. Each host may run one or moreservices. For example, as shown in FIG. 15D, host 210A may run one ormore instances of service 110A, host 210B may run one or more instancesof service 110B, and host 210N may run one or more instances of service110N. In one embodiment, multiple services and/or instances of the sameservice may be implemented using the same host. It is contemplated thatthe service-oriented system 1490 and/or optimization system 1350 mayinclude additional components not shown, fewer components than shown, ordifferent combinations, configurations, or quantities of the componentsshown.

Based on the optimized data location 188 determined by the optimizer180, locations for one or more data sources may be configured in theservice-oriented system. As discussed with respect to FIG. 14, aconfiguration controller 1420 may implement a configurationfunctionality (potentially in conjunction with other components) tochange the location and/or configuration of the data sources. As shownin the example of FIG. 15D, a data source 1430A may be provided forservice 110A on host 210A. The data source 1430A may be located in thesame zone 1405 as the service 110A in order to optimize the performanceand/or cost of the service 110A using the data source 1430A. Similarly,a data source 1430N may be provided for service 110N on host 210N. Thedata source 1430N may be located in the same zone 1406 as the service110N in order to optimize the performance and/or cost of the service110N using the data source 1430N. In one embodiment, the use of aparticular data source (e.g., data source 1430A) may not be specified inthe program code for a service (e.g., service 110A) that is linked tothe data source in the global optimization plan 1386.

FIG. 15E illustrates an example of global optimization of aservice-oriented system, including service location optimization fordata source access, according to some embodiments. A service-orientedsystem 1500 may implement a service-oriented architecture and mayinclude a plurality of hosts, any of which may be implemented by theexample computing device 3000 illustrated in FIG. 28. The hosts may becoupled using one or more networks 230. Although three hosts 210A, 210B,and 210N are illustrated for purposes of example, it is contemplatedthat any suitable number of hosts may be used with the service-orientedsystem 1500. The hosts 210A-210N may be located in any suitable numberof data centers and/or geographical locations. In one embodiment,individual hosts may be added to or subtracted from the service-orientedsystem 1500, e.g., based on the computing resources required to run aparticular set of services with a desired level of performance. Eachhost may run one or more services. For example, as shown in FIG. 15E,host 210B may originally run one or more instances of service 110B, andhost 210N may run one or more instances of service 110N. In oneembodiment, multiple services and/or instances of the same service maybe implemented using the same host. It is contemplated that theservice-oriented system 1500 and/or optimization system 1350 may includeadditional components not shown, fewer components than shown, ordifferent combinations, configurations, or quantities of the componentsshown.

In one embodiment, the optimizer 180 may include a functionality 191 foroptimizing service location for data source access. Using inputs such asthe performance metrics 165, cost metrics 166, and/or call graph(s) 175,the service location optimization functionality 191 may determine newlocations for one or more services to optimize the access of thoseservices to one or more data sources. For example, the optimizer 180 maydetermine that an instance of service 110B should be installed on thesame host 210A as a data source 1430A that the service 110B uses asinput. In one embodiment, the original instance of the service 110B maybe removed from its original host 210B. As discussed with respect toFIG. 14, a configuration controller 1420 may implement a configurationfunctionality (potentially in conjunction with other components) tochange the location and/or configuration of the service 110B foroptimized access to the data source 1430A. The relocated service 110Bmay be located on the same host as the data source 1430A in order tooptimize the performance and/or cost of the service 110B and/or the datasource 1430A. In one embodiment, the use of a particular data source(e.g., data source 1430A) may not be specified in the program code for aservice (e.g., service 110B) that is linked to the data source in theglobal optimization plan 1386.

FIG. 15F illustrates an example of global optimization of aservice-oriented system, including optimization of responseprecomputation, according to some embodiments. Using the optimizedresponse precomputation functionality 190, the optimization system mayanalyze a service-oriented system 1550 and generate an optimized versionof the service-oriented system 1560. In the initial state of theservice-oriented system 1550, a writer component (e.g., a service) maymodify data 1535 and store the data in a data store 1530. Upon requestfrom a reader component 1520 (e.g., another service), a service 110M mayretrieve the data 1535 from the data store, compute a response bymodifying or otherwise processing the data, and send the response to thereader.

The optimization system 1350 may determine an optimized configurationfor the service-oriented system in which the response from the service110M is computed before the reader 1520 requests the response.Accordingly, in the optimized version of the service-oriented system1560, the service 110M may be notified proactively when the writer 1510changes the data 1535. The service 110M may read the data 1535 (e.g.,from the writer 1510 or from the data store 1530) and precompute aresponse 1536 by modifying or otherwise processing the data. The service110M may store the precomputed response 1536 in the data store 1530.When the reader 1520 requests the response 1536, the precomputedresponse 1536 may be provided to the reader 1520 without additionalcomputation on the data 1535. In the optimized version of theservice-oriented system 1560, the update of the data 1535 along with thecomputation (by service 110M) and the storage of the response 1536 maybe wrapped in a transaction, e.g., to preserve the semantics present inthe original system 1550. In one embodiment, the transaction may beskipped if possible, e.g., if the transactional guarantee is notrequired. In one embodiment, if response 1536 is older than the data1535, then the original service 110M may be used to compute a freshvalue. In this manner, the performance and/or cost of theservice-oriented system may be improved.

FIG. 16 is a flowchart illustrating a method for global optimization ofa service-oriented system, according to some embodiments. As shown in1605, service interactions may be monitored at services in aservice-oriented system, and trace data describing the interactions maybe generated. As shown in 1610, one or more performance metrics may bedetermined based on the trace data. The performance metrics may relateto any suitable elements of the service-oriented system, includingservices, hosts, and other components. As shown in 1615, the costs ofvarious configuration options in the service-oriented system may bedetermined. Each of the configuration options may include aconfiguration parameter and a value for that configuration parameter.

As shown in 1620, an optimized configuration may be determined for theservice-oriented system based on the costs and the performance metrics.The optimized configuration may include a selection of one or more ofthe plurality of configuration options. The optimized configuration mayimprove at least one performance metric and/or at least one cost acrossat least a portion of the service-oriented system. The optimizedconfiguration may be determined using an automated optimizer or otherautomated process. The automated optimization may be performedautomatically (e.g., without being directly prompted by user input)and/or programmatically (e.g., according to program instructions). Asshown in 1625, the optimized configuration may be deployed to theservice-oriented system. In one embodiment, one or more of theoperations shown in FIG. 16, such as the operations shown in 1620 and1625, may be performed a plurality of times (e.g., over an interval oftime) to further refine the optimized configuration of theservice-oriented system.

Edge Relocation

FIG. 17A illustrates an example system environment for service-orientedsystem optimization using edge relocation, according to someembodiments. A service-oriented system 1700 may implement aservice-oriented architecture and may include a plurality of hosts, anyof which may be implemented by the example computing device 3000illustrated in FIG. 28. The hosts may be coupled using one or morenetworks 230. Although four hosts 210A, 210B, 210F, and 210N areillustrated for purposes of example, it is contemplated that anysuitable number of hosts may be used with the service-oriented system1700. In one embodiment, host 210F may be physically located within thesame nexus 1705 as one or more client devices, such as client device1710. Hosts 210A, 210B, and 210N may be located outside the nexus 1705.The nexus 1705 may represent a geographical area having closer proximityto the client device 1710 and/or a network configuration or otherlogical arrangement having lower latency for traffic with the clientdevice 1710 in comparison to the locations of the other hosts 210A,210B, and 210N. Due to its proximity to the client device 1710, the host210F may be referred to as an edge host.

In one embodiment, individual hosts may be added to or subtracted fromthe service-oriented system 1700, e.g., based on the computing resourcesrequired to run a particular set of services with a desired level ofperformance. Each host may run one or more services. For example, asshown in FIG. 17A, host 210A may originally run an instance of service110A, host 210B may run an instance of service 110B, and host 210N mayrun an instance of service 110N. In one embodiment, multiple servicesand/or instances of the same service may be implemented using the samehost. It is contemplated that the service-oriented system 1700 and/oroptimization system 150 may include additional components not shown,fewer components than shown, or different combinations, configurations,or quantities of the components shown.

In some embodiments, the hosts 210A-210N may be implemented as virtualcompute instances or as physical compute instances. The virtual computeinstances and/or physical compute instances may be offered to clients,provisioned, and maintained by a provider network that managescomputational resources, memory resources, storage resources, andnetwork resources. A virtual compute instance may comprise one or moreservers with a specified computational capacity (which may be specifiedby indicating the type and number of CPUs, the main memory size, and soon) and a specified software stack (e.g., a particular version of anoperating system, which may in turn run on top of a hypervisor). One ormore virtual compute instances may be implemented by the examplecomputing device 3000 illustrated in FIG. 28.

In one embodiment, a suitable component of the service-oriented system1700 may provision and/or configure the hosts 210A-210N. For example,the hosts 210A-210N may be provisioned from a pool of available computeinstances by selecting available compute instances with suitablespecifications and configuring the selected compute instances withsuitable software. In one embodiment, additional compute instances maybe added to the service-oriented system 1700 as needed. In oneembodiment, compute instances may be returned to the pool of availablecompute instances from service-oriented system 1700, e.g., if thecomputing instances are not needed at a particular point in time.Additionally, the software installed on the hosts may be modified. Aservice relocation controller 220 may implement such a provisioning andconfiguration functionality (potentially in conjunction with othercomponents) to cause one or more hosts to be added to theservice-oriented system 1700, cause one or more hosts to be removed fromthe service-oriented system 1700, cause one or more services to beremoved from one or more hosts, and/or cause one or more services to beadded to one or more hosts. The service relocation controller 220 may beimplemented by the example computing device 3000 illustrated in FIG. 28and may be implemented as a physical compute instance or virtual computeinstance.

The number of hosts and/or configuration of the hosts may be modified inaccordance with the optimized configuration 185. In one embodiment, thenumber and/or configuration of the hosts may be modified dynamically,e.g., while the service-oriented system 1700 remains operational toserve requests. Based on the trace data, the optimization system 150 maygenerate an optimized configuration 185 in which the original instanceof the service 110A does not run on host 210A. The optimizedconfiguration 185 may instead indicate that another instance of theservice 110A should run on the edge host 210F. In accordance with theoptimized configuration 185, the service-oriented system 1700 may bemodified to relocate or migrate the service 110A from the original host210A to the edge host 210F. Due to the increased proximity of edge host210F to the client device 1710, the relocation of the service 110A mayyield performance and/or cost improvements such as lower latency fornetwork traffic between the service-oriented system 1700 and the clientdevice 1710.

In one embodiment, the optimization system 150 may generate a servicerelocation plan 186 based on the optimized configuration 185 and sendthe plan to the service relocation controller 220. The servicerelocation plan 186 may include an indication of the original locationand/or host and the new location and/or host for each service whoselocation or host is modified in the optimized configuration 185. Usingthe service relocation plan 186, the service relocation controller 220may implement the relocation or migration of one or more services, suchas service 110A. Accordingly, the service relocation controller 220 mayprovision the edge host 210F (if necessary) and add the new instance ofthe service 110A to the edge host 210F. In one embodiment, the edge host210F may be part of a content delivery network (CDN) that is closer tousers (e.g., in terms of network latency and/or geography) than theother hosts 210A, 210B, and 210N in the service-oriented system 1700.Access to the CDN may be leased by the operator of the service-orientedsystem 1700 prior to the relocation of the service 110A.

Additionally, if so indicated in the service relocation plan 186, theservice relocation controller 220 may remove the original instance ofthe service 110A from the host 210A. In some scenarios, however, theoriginal instance of the service 110A on host 210A may be left in placeto run in parallel with the new instance of the service 110A on host210C. In one embodiment, a service (e.g., service 110A) may includemultiple components that may run independently, and only a portion ofthe service may be relocated based on the optimized configuration 185.For example, as discussed above, a partial service may be generatedbased on frequently used code in original service 110A, and that partialservice may be deployed to the edge host 210F rather than the originalservice. In one embodiment, the host 210A may be removed from theservice-oriented system 1700 and returned to the pool of available hostsif it no longer provides any services after removal of the originalinstance of the service 110A. The service relocation controller 220 mayalso perform any steps needed to inform other services of the locationof the new instance of the service 110A. In this manner, theservice-oriented system 1700 may be reconfigured to provide improvedperformance (e.g., improved transit times, throughput, or reliability)or to be implemented at an improved cost.

In one embodiment, for further performance improvements, a service orpartial service may also be relocated to the client device 1710 inaddition to the relocation to the edge host 210F. In one embodiment,program code for the relocated service(s) may be translated to a formatexecutable on the edge host 210F. In one embodiment, execution on theedge host may be more expensive than execution on one of the other hostsin the service-oriented system. However, the cost of sending data fromthe edge host 210F to the client device 1710 may be lower than the costof sending the same data from one of the other hosts to the clientdevice 1710. Accordingly, the optimized configuration, including therelocation of the service to the edge host 210F, may be determined basedon a balancing of the estimated cost of executing the relocated serviceon the edge host and the estimated cost of sending data to the clientdevice 1710. The optimized configuration, including the relocation ofthe service to the edge host 210F, may also be determined based on asecurity risk analysis of executing the relocated service on the edgehost.

FIG. 17B illustrates further aspects of an example system environmentfor service-oriented system optimization using edge relocation,according to some embodiments. In one embodiment, the service previouslyrelocated to the edge host 210F may be moved back to the original host210A (or to any of the other hosts in the service-oriented system 1700)to implement further optimization. For example, additional trace datamay be collected, and a further optimized configuration 1785 may bedetermined by the optimizer 180 based on the additional trace data.Based on the further optimized configuration 1785, the optimizationsystem 150 may generate another service relocation plan 1786 whichindicates that an instance of the service 110A should be deployed to anon-edge server such as host 210A. If conditions have changed sinceimplementing the optimized configuration 185, then implementing thefurther optimized configuration 1785 to relocate the service 110A backto the host 210A may improve a performance metric and/or cost in theservice-oriented system 1700.

The number of hosts and/or configuration of the hosts may be modified inaccordance with the further optimized configuration 1785. In oneembodiment, the number and/or configuration of the hosts may be modifieddynamically, e.g., while the service-oriented system 1700 remainsoperational to serve requests. Based on the additional trace data, theoptimization system 150 may generate an optimized configuration 1785 inwhich the original instance of the service 110A does not run on edgehost 210F. The optimized configuration 1785 may instead indicate thatanother instance of the service 110A should run on the non-edge host210A. In accordance with the optimized configuration 1785, theservice-oriented system 1700 may be modified to relocate or migrate theservice 110A from the edge host 210F to the host 210A. Due to changedconditions since the original relocation, the further relocation of theservice 110A may yield performance and/or cost improvements.

In one embodiment, the optimization system 150 may generate a servicerelocation plan 1786 based on the optimized configuration 1785 and sendthe plan to the service relocation controller 220. The servicerelocation plan 1786 may include an indication of the original locationand/or host and the new location and/or host for each service whoselocation or host is modified in the optimized configuration 1785. Usingthe service relocation plan 1786, the service relocation controller 220may implement the relocation or migration of one or more services, suchas service 110A. Accordingly, the service relocation controller 220 mayprovision the host 210A (if necessary) and add the new instance of theservice 110A to the host 210A.

Additionally, if so indicated in the service relocation plan 1786, theservice relocation controller 220 may remove the original instance ofthe service 110A from the edge host 210F. In some scenarios, however,the original instance of the service 110A on host 210F may be left inplace to run in parallel with the new instance of the service 110A onhost 210A. In one embodiment, a service (e.g., service 110A) may includemultiple components that may run independently, and only a portion ofthe service may be relocated based on the optimized configuration 1785.For example, as discussed above, a partial service may be generatedbased on frequently used code in original service 110A, and that partialservice may be deployed to the edge host 210A rather than the originalservice. In one embodiment, the host 210F may be removed from theservice-oriented system 1700 and returned to the pool of available hostsif it no longer provides any services after removal of the originalinstance of the service 110A. The service relocation controller 220 mayalso perform any steps needed to inform other services of the locationof the new instance of the service 110A. In this manner, theservice-oriented system 1700 may be reconfigured to provide improvedperformance (e.g., improved transit times, throughput, or reliability)or to be implemented at an improved cost.

FIG. 18 is a flowchart illustrating a method for service-oriented systemoptimization using edge relocation, according to some embodiments. Asshown in 1805, service interactions may be monitored at services in aservice-oriented system, and trace data describing the interactions maybe generated. As shown in 1810, an optimized configuration for theservice-oriented system may be determined based on the trace data. Asshown in 1815, one or more of the services may be relocated to one ormore edge hosts based on the optimized configuration. The relocation mayimprove a total performance metric for at least a portion of theservice-oriented system. For example, the relocation may improve a totalperformance metric for one or more service interactions involving therelocated service(s) and/or the edge host(s).

Client Device Relocation

FIG. 19A illustrates an example system environment for service-orientedsystem optimization using client device relocation, according to someembodiments. A service-oriented system 1900 may implement aservice-oriented architecture and may include a plurality of hosts, anyof which may be implemented by the example computing device 3000illustrated in FIG. 28. The hosts may be coupled using one or morenetworks 230. Although three hosts 210A, 210B, and 210N are illustratedfor purposes of example, it is contemplated that any suitable number ofhosts may be used with the service-oriented system 1900.

In one embodiment, individual hosts may be added to or subtracted fromthe service-oriented system 1900, e.g., based on the computing resourcesrequired to run a particular set of services with a desired level ofperformance. Each host may run one or more services. For example, asshown in FIG. 19A, host 210A may originally run an instance of service110A, host 210B may run an instance of service 110B, and host 210N mayrun an instance of service 110N. In one embodiment, multiple servicesand/or instances of the same service may be implemented using the samehost. It is contemplated that the service-oriented system 1900 and/oroptimization system 150 may include additional components not shown,fewer components than shown, or different combinations, configurations,or quantities of the components shown.

In some embodiments, the hosts 210A-210N may be implemented as virtualcompute instances or as physical compute instances. The virtual computeinstances and/or physical compute instances may be offered to clients,provisioned, and maintained by a provider network that managescomputational resources, memory resources, storage resources, andnetwork resources. A virtual compute instance may comprise one or moreservers with a specified computational capacity (which may be specifiedby indicating the type and number of CPUs, the main memory size, and soon) and a specified software stack (e.g., a particular version of anoperating system, which may in turn run on top of a hypervisor). One ormore virtual compute instances may be implemented by the examplecomputing device 3000 illustrated in FIG. 28.

In one embodiment, a suitable component of the service-oriented system1900 may provision and/or configure the hosts 210A-210N. For example,the hosts 210A-210N may be provisioned from a pool of available computeinstances by selecting available compute instances with suitablespecifications and configuring the selected compute instances withsuitable software. In one embodiment, additional compute instances maybe added to the service-oriented system 1900 as needed. In oneembodiment, compute instances may be returned to the pool of availablecompute instances from service-oriented system 1900, e.g., if thecomputing instances are not needed at a particular point in time.Additionally, the software installed on the hosts may be modified. Aservice relocation controller 220 may implement such a provisioning andconfiguration functionality (potentially in conjunction with othercomponents) to cause one or more hosts to be added to theservice-oriented system 1900, cause one or more hosts to be removed fromthe service-oriented system 1900, cause one or more services to beremoved from one or more hosts, and/or cause one or more services to beadded to one or more hosts. The service relocation controller 220 may beimplemented by the example computing device 3000 illustrated in FIG. 28and may be implemented as a physical compute instance or virtual computeinstance.

The number of hosts and/or configuration of the hosts may be modified inaccordance with the optimized configuration 185. In one embodiment, thenumber and/or configuration of the hosts may be modified dynamically,e.g., while the service-oriented system 1900 remains operational toserve requests. Based on the trace data, the optimization system 150 maygenerate an optimized configuration 185 in which the original instanceof the service 110A does not run on host 210A. The optimizedconfiguration 185 may instead indicate that another instance of theservice 110A should run on a client device 1710. In accordance with theoptimized configuration 185, the service-oriented system 1900 may bemodified to relocate or migrate the service 110A from the original host210A to the client device 1710. The relocation of the service 110A tothe client device 1710 may yield performance and/or cost improvementsfor service interactions involving the relocated service on the clientdevice 1710. In one embodiment, the relocation of the service 110A tothe client device 1710 may produce an improved user experience.

In one embodiment, the optimization system 150 may generate a servicerelocation plan 186 based on the optimized configuration 185 and sendthe plan to the service relocation controller 220. The servicerelocation plan 186 may include an indication of the original locationand/or host and the new location and/or host for each service whoselocation or host is modified in the optimized configuration 185. Usingthe service relocation plan 186, the service relocation controller 220may implement the relocation or migration of one or more services, suchas service 110A. Accordingly, the service relocation controller 220 maytake any suitable measures to add the new instance of the service 110Ato the client device 1710. For example, the new instance of the service110A may be included with a software update released through an appstore or other software marketplace. In one embodiment, the new instanceof the service 110A may be deployed to the client device 1710 in amanner that does not violate user expectations regarding softwareinstallation. For example, the software update may be manuallydownloaded by a user of the client device 1710. As another example, thenew instance of the service 110A may be automatically downloaded to theclient device 1710 if a user of the client device 1710 has affirmativelyopted in to receive automatic software updates.

In one embodiment, the functionality of the service 110A may beinitially included in software deployed to the client device 1710, butthe functionality of the service 110A may be disabled upon installation.However, the functionality of the service 110A may be enabled on theclient device 1710 at any suitable time, such as when the optimizedconfiguration 185 indicates that the service 110A should be relocated tothe client device 1710. Similarly, the functionality of the service 110Amay be disabled on the client device 1710 at any suitable time.

Additionally, if so indicated in the service relocation plan 186, theservice relocation controller 220 may remove the original instance ofthe service 110A from the host 210A. In some scenarios, however, theoriginal instance of the service 110A on host 210A may be left in placeto run in parallel with the new instance of the service 110A on theclient device 1710. In one embodiment, a service (e.g., service 110A)may include multiple components that may run independently, and only aportion of the service may be relocated based on the optimizedconfiguration 185. For example, as discussed above, a partial servicemay be generated based on frequently used code in original service 110A,and that partial service may be deployed to the client device 1710rather than the original service. In one embodiment, the host 210A maybe removed from the service-oriented system 1900 and returned to thepool of available hosts if it no longer provides any services afterremoval of the original instance of the service 110A. The servicerelocation controller 220 may also perform any steps needed to informother services of the location of the new instance of the service 110A.In this manner, the service-oriented system 1900 may be reconfigured toprovide improved performance (e.g., improved transit times, throughput,or reliability) or to be implemented at an improved cost.

In one embodiment, for further performance improvements, a service orpartial service may also be relocated to an edge host in addition to therelocation to the client device 1710. In one embodiment, program codefor the relocated service(s) may be translated to a format executable onthe client device 1710. The optimized configuration, including therelocation of the service to the client device 1710, may be determinedbased on an estimated cost of executing the relocated service (andoptionally one or more other services) on the client device 1710 and/ortransmitting data to or from the client device 1710. The optimizedconfiguration, including the relocation of the service to the clientdevice 1710, may be determined based on a security risk analysis ofexecuting the relocated service on the client device 1710.

In one embodiment, one or more services may be deployed to a set ofclient devices that may interact with one another. For example, the setof client devices may be managed by a single user. The set of clientdevices may include different types of devices, including various typesof mobile devices, desktop computers, etc. In one embodiment, the one ormore services on the set of client devices may share state and/orotherwise collaborate with one another to provide functionality acrossthe set of client devices in an optimized manner.

FIG. 19B illustrates further aspects of an example system environmentfor service-oriented system optimization using client device relocation,according to some embodiments. In one embodiment, the service previouslyrelocated to the client device 1710 may be moved back to the originalhost 210A (or to any of the other hosts in the service-oriented system1900) to implement further optimization. For example, additional tracedata may be collected, and a further optimized configuration 1985 may bedetermined by the optimizer 180 based on the additional trace data.Based on the further optimized configuration 1985, the optimizationsystem 150 may generate another service relocation plan 1986 whichindicates that an instance of the service 110A should be deployed to aserver such as host 210A. If conditions have changed since implementingthe optimized configuration 185, then implementing the further optimizedconfiguration 1985 to relocate the service 110A back to the host 210Amay improve a performance metric and/or cost in the service-orientedsystem 1900.

The number of hosts and/or configuration of the hosts may be modified inaccordance with the further optimized configuration 1985. In oneembodiment, the number and/or configuration of the hosts may be modifieddynamically, e.g., while the service-oriented system 1900 remainsoperational to serve requests. Based on the trace data, the optimizationsystem 150 may generate an optimized configuration 1985 in which theoriginal instance of the service 110A does not run on the client device1710. The further optimized configuration 1985 may instead indicate thatanother instance of the service 110A should run on the host 210A. Inaccordance with the further optimized configuration 1985, theservice-oriented system 1900 may be modified to relocate or migrate theservice 110A from the client device 1710 to the host 210A. Due tochanged conditions since the original relocation, the further relocationof the service 110A may yield performance and/or cost improvements.

In one embodiment, the optimization system 150 may generate a servicerelocation plan 1986 based on the optimized configuration 1985 and sendthe plan to the service relocation controller 220. The servicerelocation plan 1986 may include an indication of the original locationand/or host and the new location and/or host for each service whoselocation or host is modified in the optimized configuration 1985. Usingthe service relocation plan 1986, the service relocation controller 220may implement the relocation or migration of one or more services, suchas service 110A. Accordingly, the service relocation controller 220 mayprovision the host 210A (if necessary) and add the new instance of theservice 110A to the host 210A.

Additionally, if so indicated in the service relocation plan 1986, theservice relocation controller 220 may remove the original instance ofthe service 110A from the client device 1710. In some scenarios,however, the original instance of the service 110A on client device 1710may be left in place to run in parallel with the new instance of theservice 110A on host 210A. In one embodiment, a service (e.g., service110A) may include multiple components that may run independently, andonly a portion of the service may be relocated based on the optimizedconfiguration 1985. For example, as discussed above, a partial servicemay be generated based on frequently used code in original service 110A,and that partial service may be deployed to the host 210A rather thanthe original service. The service relocation controller 220 may alsoperform any steps needed to inform other services of the location of thenew instance of the service 110A. In this manner, the service-orientedsystem 1900 may be reconfigured to provide improved performance (e.g.,improved transit times, throughput, or reliability) or to be implementedat an improved cost.

FIG. 20 is a flowchart illustrating a method for service-oriented systemoptimization using client device relocation, according to someembodiments. As shown in 2005, service interactions may be monitored atservices in a service-oriented system, and trace data describing theinteractions may be generated. As shown in 2010, an optimizedconfiguration for the service-oriented system may be determined based onthe trace data. As shown in 2015, one or more of the services may berelocated to one or more client devices based on the optimizedconfiguration. The relocation may improve a total performance metric forat least a portion of the service-oriented system. For example, therelocation may improve a total performance metric for one or moreservice interactions involving the relocated service(s) and/or theclient device(s).

Tracking Service Requests

For clarity of description, various terms may be useful for describingelements of a call graph. Note that the following terminology may onlybe applicable to services and requests of a given call graph. In otherwords, the following terminology may only be applicable for services andrequests associated with the same root request. From the perspective ofa particular service, any service that calls the particular service maybe referred to as a “parent service.” Furthermore, from the perspectiveof a particular service, any service that the particular service callsmay be referred to as a “child service.” In a similar fashion, from theperspective of a particular request, any request from which theparticular request stems may be referred to as a “parent request.”Furthermore, from the perspective of a particular request, any requeststemming from the particular request may be referred to as a “childrequest.” Additionally, as used herein the phrases “request,” “call,”“service request” and “service call” may be used interchangeably. Notethat this terminology refers to the nature of the propagation of aparticular request throughout the present system and is not intended tolimit the physical configuration of the services. As may sometimes bethe case with service-oriented architectures employing modularity, eachservice may in some embodiments be independent of other services in theservice-oriented system (e.g., the source code of services or theirunderlying components may be configured such that interdependenciesamong source and/or machine code are not present).

As described above, a given parent request may result in multiple childservice calls to other services. In various embodiments of the systemand method for tracking service requests, request identifiers embeddedwithin such service calls (or located elsewhere) may be utilized togenerate a stored representation of a call graph for a given request. Invarious embodiments, such request identifiers may be stored in log filesassociated with various services. For instance, a service may storeidentifiers for inbound requests in an inbound request log and/or storeidentifiers for outbound requests in an outbound request log. In variousembodiments, call graph generation logic may generate a representationof a call graph from identifiers retrieved from such logs. Suchrepresentations may be utilized for diagnosing errors with requesthandling, providing developer support, and performing traffic analysis.

FIG. 21 illustrates an example format for a request identifier 2100 ofvarious embodiments. As described in more detail below, requestidentifiers of the illustrated format may be passed along with servicerequests. For instance, a service that calls another service may embedin the call an identifier formatted according to the format illustratedby FIG. 21. For example, a requesting service may embed a requestidentifier within metadata of a request. In various embodiments,embedding a request identifier in a service request may includeembedding within the service request, information that specifies wherethe request identifier is located (e.g., a pointer or memory address ofa location in memory where the request identifier is stored). Thevarious components of the illustrated request identifier format aredescribed in more detail below.

An origin identifier (ID) 2110 may be an identifier assigned to allrequests of a given call graph, which includes the initial root requestas well as subsequent requests spawned as a result of the initial rootrequest. For example, as described above, the service-oriented systemsof various embodiments may be configured to process requests fromvarious internal or external systems, such as client computer systems orcomputer systems consuming networked-based services. To fulfill one ofsuch requests, the service-oriented system may call multiple differentservices. For instance, service “A” may be the initial service called tofulfill a request (e.g., service “A” may be called by an externalsystem). To fulfill the initial request, service “A” may call service“B,” which may call service “C,” and so on. Each of such services mayperform a particular function or quantum of work in order to fulfill theinitial request. In various embodiments, each of such services may beconfigured to embed the same origin identifier 2110 into a request of(or call to) another service. Accordingly, each of such requests may beassociated with each other by virtue of containing the same originidentifier. As described in more detail below, the call graph generationlogic of various embodiments may be configured to determine that requestidentifiers having the same origin identifier are members of the samecall graph.

The manner in which the origin identifier may be represented may varyaccording to various embodiments and implementations. One particularexample of an origin identifier may include a hexadecimal stringrepresentation of a standard Universally Unique Identifier (UUID) asdefined in Request for Comments (RFC) 4122 published by the InternetEngineering Task Force (IETF). In one particular embodiment, the originidentifier may contain only lower-case alphabetic characters in order toenable fast case-sensitive comparison of request identifiers (e.g., acomparison performed by the call graph generation logic describedbelow). Note that these particular examples are not intended to limitthe implementation of the origin ID. In various embodiments, the originID may be generated according to other formats.

Transaction depth 2120 may indicate the depth of a current requestwithin the call graph. For instance (as described above), service “A”may be the initial service called to fulfill a root request (e.g.,service “A” may be called by an external system). To fulfill the initialrequest, service “A” may call service “B,” which may call service “C,”and so on. In various embodiments, the depth of the initial request maybe set to 0. For instance, when the first service or “root” servicereceives the root service request, the root service (e.g., service “A”)may set the transaction depth 120 to 0. If in response to this requestthe originating service calls one or more other services, thetransaction depth for these requests may be incremented by 1. Forinstance, if service “A” were to call two other services “B1” and “B2,”the transaction depth of the request identifiers passed to such serviceswould be equivalent to 1. The transaction depth for request identifiersof corresponding requests sent by B1 and B2 would be incremented to 2and so on. In the context of a call graph, the transaction depth of aparticular request may in various embodiments represent the distance(e.g., number of requests) between that request and the root request.For example, the depth of the root request may be 0, the depth of arequest stemming from the root request may be 1, and so on. Note that invarious embodiments, such numbering system may be somewhat arbitrary andopen to modification.

The manner in which the origin identifier may be represented may varyaccording to various embodiments and implementations. One particularexample of a transaction depth may be represented as a variable-widthbase-64 number. In various embodiments, the value of a given transactiondepth may be but need not be a value equivalent to the increment of theprevious transaction depth. For instance, in some embodiments, eachtransaction depth may be assigned a unique identifier, which may beincluded in the request identifier instead of the illustratedtransaction depth 2120.

Interaction identifiers 2130 a-2130 n, collectively referred to asinteraction identifier(s) 2130, may each identify a single request (orservice call) for a given call graph. For instance (as described above),service “A” may be the initial service called to fulfill a request(e.g., service “A” may be called by an external system). To fulfill theroot request, service “A” may call service “B,” which may call service“C,” and so on. In one example, the call of service “B” by service “A”may be identified by interaction identifier 2130 a, the call of service“C” by service “B” may be identified by interaction identifier 2130 band so on.

Note that in various embodiments separate service requests between thesame services may have separate and unique interaction identifiers. Forexample, if service “A” calls service “B” three times, each of suchcalls may be assigned a different interaction identifier. In variousembodiments, this characteristic may ensure that the associated requestidentifiers are also unique across service requests between the sameservices (since the request identifiers include the interactionsidentifiers).

Note that in various embodiments the interaction identifier may be butneed not be globally unique (e.g., unique with respect to all otherinteraction identifiers). For instance, in some embodiments, a giveninteraction identifier for a given request need be unique only withrespect to request identifiers having a particular origin identifier2110 and/or a particular parent interaction identifier, which may be theinteraction identifier of the request preceding the given request in thecall graph (i.e., the interaction identifier of the request identifierof the parent service). In one example, if service “A” were to call twoother services “B1” and “B2,” the request identifier of service “B1” andthe request identifier of service “B2” would have separate interactionidentifiers. Moreover, the parent interaction identifier of each of suchinteraction identifiers may be the interaction identifier of the requestidentifier associated with the call of service “A.” The relationshipbetween interaction identifiers and parent interaction identifiers isdescribed in more detail below.

In various embodiments, interaction identifiers may be generatedrandomly or pseudo-randomly. In some cases, the values generated for aninteraction identifier may have a high probability of uniqueness withinthe context of parent interaction and/or a given transaction depth. Insome embodiments, the size of the random numbers that need to begenerated depends on the number of requests a service makes.

Request stack 2140 may include one or more of the interactionidentifiers described above. In various embodiments, the request stackmay include the interaction identifier of the request to which therequest identifier belongs. In some embodiments, the request stack mayalso include other interaction identifiers, such as one or more parentinteraction identifiers of prior requests (e.g., a “stack” or “history”of previous interaction identifiers in the call graph). In variousembodiments, the request stack may have a fixed size. For instance, therequest stack 2140 may store a fixed quantity of interaction identifiersincluding the interaction identifier of the request to which the requestidentifier belongs and one or more parent interaction identifiers.

In various embodiments, the utilization of a request stack having afixed length (e.g., fixed quantity of stored interaction identifiers)may provide a mechanism to control storage and bandwidth throughout theservice-oriented system. For example, the service-oriented system ofvarious embodiments may in some cases receive numerous (e.g., thousands,millions, or some other quantity) of service requests per a given timeperiod (e.g., per day, per week, or some other time period), such asrequests from network-based browsers (e.g., web browsers) on clientsystems or requests from computer systems consuming network-basedservices (e.g., web services). In some embodiments, a request identifieradhering to the format of request identifier 2100 may be generated foreach of such requests and each of any subsequent child requests. Due tothe shear number of requests that may be handled by the service-orientedsystems of various embodiments, even when the request stack of a singlerequest identifier is of a relatively small size (e.g., a few bytes),the implications on storage and bandwidth of the overall system may insome cases be significant. Accordingly, various embodiments may includeensuring that each request identifier contains a request stack equal toand/or less than a fixed stack size (e.g., a fixed quantity ofinteraction identifiers). Similarly, various embodiments may includefixing the length of each interaction identifier stored as part of therequest stack (e.g., each interaction identifier could be limited to asingle byte, or some other size). By utilizing interaction identifiersof fixed size and/or a request stack of a fixed size, variousembodiments may be configured to control the bandwidth and/or storageutilization of the service-oriented system described herein. Forinstance, in one example, historical request traffic (e.g., the numberof requests handled by the service oriented system per a given timeperiod) may be monitored to determine an optimal request stack sizeand/or interaction identifier size in order to prevent exceeding thebandwidth or storage limitations of the service-oriented system.

In various embodiments, the utilization of a request stack having afixed length (e.g., fixed quantity of stored interaction identifiers)may provide a mechanism to control one or more fault tolerancerequirements of the system including but not limited to durability withrespect to data loss and other errors (associated with individualservices and host systems as well as the entire service-orientedsystem). For example, in some embodiments, the larger the size of therequest stack (e.g., the more interaction identifiers included within agiven request identifier), the more fault tolerant the system becomes.

In embodiments where request stack 2140 includes multiple interactionidentifiers, the request stack may serve as a history of interactionidentifiers. For instance, in the illustrated embodiment, interactionidentifier 2130 a-2130 n may represent a series of interactionidentifiers in ascending chronological order (where interactionidentifier 2130 a corresponds to the oldest service call and interactionidentifier 2130 n corresponds to the most recent service call).

In addition to the illustrated elements, request identifier 2100 may invarious embodiments include one or more portions of data for errordetection and/or error correction. Examples of such data include but arenot limited to various types of checksums.

FIG. 22 illustrates an example transaction flow for a root request andmultiple child requests associated with the same root request. Asillustrated, the transaction flow may begin with the receipt of a rootrequest by service “A.” For instance, this initial request mightoriginate from a client computer system (e.g., from a web browser) orfrom another computer system requesting a service to consume. Tocompletely fulfill the request, service “A” may perform some quantum ofwork and/or request the services of another service, such as service “B”(see, e.g., request identifier 2220). Service “B” may call anotherservice “C” (see, e.g., request identifier 2230) and so on asillustrated (see, e.g., request identifiers 2240-2250). As illustrated,since each request identifier 2210-2250 corresponds to a request of thesame transaction, each of such request identifiers include the sameorigin identifier “343CD324.” For instance, each of services A-D mayembed such origin identifier within each of such request identifiers(described in more detail with respect to FIG. 23). Furthermore, in theillustrated embodiment, the request identifier corresponding to theinitial service request includes a transaction depth of 0 since therequest identifier is a parent request identifier, as described above.Each subsequent child request identifier includes a transactionidentifier equivalent to the previous requests transaction depth plus anincrement value. In other embodiments, instead of incremented values,the transaction depths may be values that uniquely identify atransaction depth with respect to other depths of a given call graph;such values may but need not be increments of each other.

In the illustrated example, each request identifier 2210-2250 includes arequest stack of a fixed size (e.g., three interaction identifiers). Inother embodiments, larger or smaller request stacks may be utilized aslong as the request stack includes at least one interaction identifier.Furthermore, in some embodiments, request stack sizes may be of uniformsize across the service-oriented system (as is the case in theillustrated embodiment). However, in other embodiments, subsets ofservices may have different request stack sizes. For instance, a portionof the service-oriented system may utilize a particular fixed stack sizefor request identifiers whereas another portion of the service-orientedsystem may utilize another fixed stack fixed stack size for requestidentifiers.

Referring collectively to FIG. 22 and FIG. 23, a representation of thereceipt of an inbound service request (or service call) 2310 as well asthe issuance of an outbound request 2320 by service 2300 is illustrated.Request identifiers 2240 and 2250 of FIG. 23 may correspond to thelike-numbered elements of FIG. 22. As illustrated, service 2300 mayreceive an inbound service request 2310. Service 2300 may receive theinbound service request from another service within the service-orientedsystem, according to various embodiments. Inbound service request 2310may include the requisite instructions or commands for invoking service2300. In various embodiments, inbound service request 2310 may alsoinclude a request identifier 2240, which may include values for anorigin identifier, transaction depth, and request stack, as describedabove with respect to FIG. 22. In various embodiments, requestidentifier 2240 may be embedded within inbound service request 2310(e.g., as metadata). For example, according to various embodiments, therequest identifier may be presented as part of metadata in a serviceframework, as part of a Hypertext Transfer Protocol (HTTP) header, aspart of a SOAP header, as part of a Representational State Transfer(REST) protocol, as part of a remote procedural call (RPC), or as partof metadata of some other protocol, whether such protocol is presentlyknown or developed in the future. In other embodiments, requestidentifier 2240 may be transmitted to service 2300 as an elementseparate from inbound service request 2310. In various embodiments,request identifier 2240 may be located elsewhere and inbound servicerequest 2310 may include information (e.g., a pointer or memory address)for accessing the request identifier at that location.

In response to receiving the inbound service request, service 2300 mayperform a designated function or quantum of work associated with therequest, such as processing requests from client computer systems orcomputer systems requesting web services. In various embodiments,service 2300 may be configured to store a copy of request identifier2240 within inbound log 2330. In some cases, service 2300 may requirethe services of another service in order to fulfill a particularrequest, as illustrated by the transmission of outbound service request2320.

As is the case in the illustrated embodiment, service 2300 may beconfigured to send one or more outbound service requests 2320 to one ormore other services in order to fulfill the corresponding root request.Such outbound service requests may also include a request identifier2250 based at least in part on the received request identifier 2240.Request identifier 2250 may be generated by service 2300 or some othercomponent with which service 2300 is configured to coordinate. Sinceoutbound service request 2320 is caused at least in part by inboundservice request 2310 (i.e., request 2320 stems from request 2310), theoutbound service request 2320 and the inbound service request 2310 canbe considered to be constituents of the same call graph. Accordingly,service 2300 (or some other component of the service-oriented framework)may be configured to generate request identifier 2250 such that therequest identifier includes the same origin identifier as that of theinbound service request 2310. In the illustrated embodiment, such originidentifier is illustrated as “343CD324.” For instance, in oneembodiment, service 2300 may be configured to determine the value of theorigin identifier of the request identifier of the inbound servicerequest and write that same value into the request identifier of anoutbound service request. In various embodiments, service 2300 (or someother component of the service-oriented framework) may also beconfigured to generate request identifier 2250 such that the requestidentifier includes a transaction depth value that indicates thetransaction depth level is one level deeper than the transaction depthof the parent request (e.g., inbound service request 2310). Forinstance, in one embodiment, any given call graph may have variousdepths that each have their own depth identifier. In some embodiments,such depth identifiers may be sequential. Accordingly, in order togenerate request identifier 2250 such that it includes a transactiondepth value that indicates the transaction depth level is one leveldeeper than the transaction depth of the parent request (e.g., inboundservice request 2310), service 2300 may be configured to determine thevalue of the transaction depth from the parent request, sum that valuewith an increment value (e.g., 1, or some other increment value), andstore the result of such summation as the transaction depth value of therequest identifier of the outbound service request. In the illustratedembodiment, the transaction depth value of the inbound requestidentifier 2240 is 3 whereas the transaction depth value of the outboundrequest identifier 2250 is 4.

In some cases, transaction depth identifiers may instead haveidentifiers that are not necessarily related to each other sequentially.Accordingly, in some embodiments, service 2300 may be configured todetermine the transaction depth value from the request identifier of theparent request. From that value, service 2300 may determine the actualdepth level corresponding to the transaction depth value (e.g., via alookup table that provides a sequential listing of transaction depthlevels to corresponding transaction depth values). From that depthlevel, service 2300 may be configured to determine the next sequentialtransaction depth (e.g., via a lookup table that provides a sequentiallisting of transaction depth levels to corresponding transaction depthvalues) as well as the transaction depth value corresponding to thattransaction depth. Service 2300 may be configured to store suchtransaction depth value as the transaction depth value of the requestidentifier of the outbound service request.

Service 2300 may also be configured to generate request identifier 2250of the outbound service request such that the request identifier has arequest stack that includes an interaction identifier associated withthe outbound service request and all of the interaction identifiers ofthe request stack of request identifier 2240 except for the oldestinteraction identifier, which in many cases may also be the interactionidentifier corresponding to a request at the highest transaction depthlevel when compared to the transaction depth levels associated with theother interaction identifiers of the request stack. For example, theroot request may occur at transaction depth “0,” a subsequent requestmay occur at transaction depth “1,” another subsequent request may occurat transaction depth “2,” and so on. In some respects, the request stackmay operate in a fashion similar to that of a first in, first out (FIFO)buffer, as described in more detail below.

To generate the request stack of request identifier 2250, service 2300may be configured to determine the interaction identifiers presentwithin the request stack of request identifier 2240. Service 2300 mayalso be configured to determine the size of the request stack that is tobe included within request identifier 2250 (i.e., the quantity ofinteraction identifiers to be included within the request stack). Insome embodiments, this size may be specified by service 2300, anotherservice within the service-oriented system (e.g., the service that is toreceive request 2320), or some other component of the service-orientedsystem (e.g., a component storing a configuration file that specifiesthe size). In other embodiments, the size of the request stack may bespecified by service 2300. In one embodiment, the size of the requeststack may be dynamically determined by service 2300 (or some othercomponent of the service-oriented system). For instance, service 2300may be configured to dynamically determine the size of the request stackbased on capacity and/or utilization of system bandwidth and/or systemstorage. In one example, service 2300 may be configured to determinethat bandwidth utilization has reached a utilization threshold (e.g., athreshold set by an administrator). In response to such determination,service 2300 may be configured to utilize a smaller request stack sizein order to conserve bandwidth. In various embodiments, a similarapproach may be applied to storage utilization.

Dependent upon the size of the inbound request stack and the determinedsize of the outbound request stack (as described above), a number ofdifferent techniques may be utilized to generate the request stack ofrequest identifier 2250, as described herein. In one scenario, the sizeof the inbound request stack may be the same as the determined size ofthe outbound request stack, as is the case in the illustratedembodiment. In this scenario, if the size of the outbound servicerequest stack is to be n interaction identifiers, service 2300 may beconfigured to determine the (n−1) most recent interaction identifiers ofthe request stack of the inbound request identifier. Service 2300 may beconfigured to embed the (n−1) most recent interaction identifiers of theinbound request stack into the request stack of the outbound requestidentifier 2250 in addition to a new interaction identifier thatcorresponds to request 2320 issued by service 2300. In the illustratedembodiment, for each request identifier, the oldest interactionidentifier is illustrated on the leftmost portion of the request stackand the newest interaction identifier is illustrated on the rightmostportion. In the illustrated embodiment, to generate the request stack ofthe outbound request identifier, service 300 may be configured to takethe request stack of the inbound request identifier, drop the leftmost(e.g., oldest) interaction identifier, shift all other interactionidentifiers to the left by one position, insert a newly generatedinteraction identifier for the outbound request, and embed this newlygenerated request stack in the request identifier of the outboundrequest.

In another scenario, the size of the request stack of the inboundservice request identifier 2240 may be less than the size of thedetermined request stack size for the outbound service requestidentifier 2250. In these cases, the request stack size of the outboundservice request may enable all of the interaction identifiers of therequest stack of the inbound service request identifier to be includedwithin the request stack of the outbound service request identifier.Accordingly, in various embodiments, service 2300 may be configured toembed all of the interaction identifiers in the request stack of theoutbound request identifier 2250 in addition to a new interactionidentifier that corresponds to request 2320 issued by service 2300.

In an additional scenario, the size of the request stack of the inboundservice request identifier 2240 may be greater than the size of thedetermined request stack size for the outbound service requestidentifier 2250. For instance, if the size of the request stack for theoutbound service request identifier is m interaction identifiers and thesize of the request stack for the inbound request identifier is m+xinteraction identifiers (where x and m are positive integers), service2300 may be configured to determine the (m−1) most recent interactionidentifiers of the request stack of the inbound request identifier.Service 2300 may also be configured to embed such (m−1) most recentinteraction identifiers of the request stack of the inbound requestidentifier into the request stack of the outbound request identifier inaddition to a new interaction identifier that corresponds to requestissued by service 2300.

As described above, inbound request log 2330 may be managed by service2300 and include records of one or more inbound service requests. In oneembodiment, for each inbound service request received, service 2300 maybe configured to store that request's identifier (which may include anorigin identifier, transaction depth, and request stack, as illustrated)within the inbound request log. In various embodiments, service 2300 mayalso store within the log various metadata associated with each inboundservice request identifier. Such metadata may include but is not limitedto timestamps (e.g., a timestamp included within the request, such as atimestamp of when the request was generated, or a timestamp generatedupon receiving the request, such as a timestamp of when the request wasreceived by service 2300), the particular quantum of work performed inresponse to the request, and/or any errors encountered while processingthe request. In various embodiments, outbound request log 2340 mayinclude information similar to that of inbound request log 2330. Forexample, for each outbound request issued, service 2300 may store arecord of such request within outbound request log 2340. For instance,service 2300 may, for each outbound request, store that request'sidentifier within outbound request log 2340. As is the case with inboundrequest log 2330, service 2300 may also store within outbound requestlog 2340 various metadata associated with requests including but notlimited to metadata such as timestamps and errors encountered.

Referring collectively to FIG. 23 and FIG. 24, each service within theservice-oriented system may include a log reporting agent, such as logreporting agent 2350. Log reporting agent 2350 may in variousembodiments report the contents of inbound request log 2330 and/oroutbound request log 2340 to a log repository (e.g., a data store, suchas a database or other location in memory). One example of such arepository is illustrated log repository 2410 of FIG. 24. Variousprotocols for transmitting records from the logs of a service 2300 to alog repository may be utilized according to various embodiments. In someembodiments, the log reporting agent may periodically or aperiodicallyprovide log information to the log repository. In various embodiments,the log reporting agent may be configured to service requests for loginformation, such as a request from the log repository or some othercomponent of the service-oriented system. In some embodiments, inaddition to or as an alternative to reporting log information from logs2330 and 2340, log reporting agent 2350 may report log information tothe log repository in real-time (in some cases bypassing the storage ofinformation within the logs altogether). For instance, as a request isdetected or generated, the log reporting agent may immediately reportthe information to the log repository. In various embodiments, log datamay specify, for each request identifier, the service that generated therequest identifier and/or the service that received the requestidentifier.

As illustrated in FIG. 24, multiple services 2300 a-2300 h within theservice-oriented system may be configured to transmit respective logdata 2400 a-2400 h to log repository 2410. The data stored within logrepository 2410 (e.g., service request identifiers and associatedmetadata) may be accessed by call graph generation logic 2420. Callgraph generation logic may be configured to generate a data structurerepresenting one or more call graphs, such as call graph data structures2430. As described above, the particular services called to fulfill aroot request may be represented as a call graph that specifies, for aparticular service called, the service that called the particularservice and any services called by the particular service. For instance,since a root request may result in a service call which may propagateinto multiple other services calls throughout the service orientedsystem, a call graph may in some cases include a deep and broad treewith multiple branches each representing a sequences of service calls.

FIG. 25 illustrates a visual representation of such a call graph datastructure that may be generated by call graph generation logic 2420. Invarious embodiments, a call graph data structure may include any datastructure that specifies, for a given root request, all the servicescalled to fulfill that root request. Note that while FIG. 25 and theassociated description pertain to an acyclic call graph, thisrepresentation is not inclusive of all variations possible for such acall graph. For instance, in other embodiments, a call graph may berepresented by any directed graph (including graphs that includedirected cycles) dependent on the nature of the service requests withinthe service-oriented system. Additionally, for a given one of suchservices, the call graph data structure may specify the service thatcalled the given service as well as any services called by the givenservice. The call graph data structure may additionally indicate ahierarchy level of a particular service within a call graph. Forinstance, in the illustrated embodiment, service 2500 is illustrated asa part of the first level of the hierarchy, service 2510 is illustratedas part of the second level of the hierarchy and so on.

To generate such a call graph, call graph generation logic may beconfigured to collect request identifiers (e.g., request identifiers2502, 2512, 2514, 2516, 2542 and 2544) that each include the same originidentifier. In the illustrated embodiment, “563BD725” denotes an exampleof such an origin identifier. In various embodiments, call graphgeneration logic may mine (e.g., perform a search or other dataanalysis) log data associated with various services in order to find acollection of request identifiers that correspond to the same originidentifier (and thus correspond to the same root request, e.g., rootrequest 2501).

In various embodiments, inbound and outbound request logs may bemaintained for each service. In these cases, call graph generation logic2420 may be configured to compare request identifiers in order todetermine that a given service called another service in the process offulfilling the root request. For example, in one embodiment, the callgraph generation logic may compare a request identifier from a givenservice's outbound request log to the request identifier from anotherservice's inbound request log. If a match is detected, the call graphgeneration logic may indicate that the service corresponding to thatoutbound request log called the service corresponding to that inboundrequest log. For example, call graph generation logic may discover arequest identifier equivalent to request identifier 2502 within theoutbound request log associated with service 2500. In this example, callgraph generation logic may also locate a request identifier equivalentto request identifier 2502 within the inbound log of service 2510. Inresponse to this match, call graph generation logic may indicate that anedge (representing a service call) exists between two particular nodesof the call graph (e.g., the node corresponding to service 2500 and thenode corresponding to service 2510). The above-described process may berepeated to determine the illustrated edges that correspond to requestidentifiers 2512, 2514, 2516, 2542 and 2544. In other embodiments, sincethe manner in which interaction identifiers are generated may ensurethat each interaction identifier is unique for a given depth level andorigin identifier, the call graph generation logic may instead searchfor matching interaction identifiers between request identifiers ofadjacent depth levels instead of searching for matching requestidentifiers.

In other embodiments, only one type of log (e.g., either inbound oroutbound) may be maintained for a given service. For example, if onlyoutbound request logs are maintained for each of the services, then thecall graph generation logic 2420 may utilize different techniques fordetermining an edge that represents a service call in the call graphdata structure. In one example, call graph generation logic may comparetwo request identifiers that have adjacent depth values. For instance,in the illustrated embodiment, the call graph generation logic may beconfigured to compare request identifier 2502 to request identifier2514, since such request identifiers contain the adjacent depth valuesof 1 and 2. In this case, the call graph generation logic may determinewhether the most recent interaction identifier of request identifier2502 (e.g., 3B) is equivalent to the 2nd most recent interactionidentifier of request identifier 2514 (e.g., 3B). For request identifier2514, the 2nd most recent interaction identifier is evaluated since themost recent interaction identifier position will be fill with a newinteraction identifier inserted by the service that generated requestidentifier 2514 (in this case, service 2530). In the illustratedembodiment, this comparison returns a match since the values for theinteraction identifiers are equivalent. In response to such match, thecall graph generation logic may be configured to indicate within thedata structure that an edge (representing a service call) exists betweenservice 2500 and 2510.

In various embodiments, the call graph generation logic 2420 may beconfigured to generate a call graph in the presence of data loss. Forinstance, consider the case where the service oriented system maintainsoutbound service logs and the log data for service 2510 is lost, asmight be the case in the event of a failure on the host system on whichservice 2510 runs or in the case of a failure of log repository 2410.Since the request identifiers of various embodiments may include arequest stack of multiple interaction identifiers, multiple layers ofredundancy may be utilized to overcome a log data loss. In this example,since the outbound log data for service 2510 is lost, requestidentifiers 2512, 2514, and 2516 may not be available. Accordingly, thecall graph generation logic may be configured to utilize a requestidentifier from a lower depth level to reconstruct the pertinent portionof the call graph. While request identifiers 2512, 2514, and 2516 may benot be available due to data loss, the request identifier 2542 (and2544) is available. Since request identifier 2542 includes a stack or“history” of interaction identifiers, that request identifier may beutilized to obtain information that would have been available if requestidentifier 2516 were not lost to data failure. Since request identifier2542 has a depth level that is two levels lower than the depth level ofrequest identifier 2502, the call graph generation logic may utilize thethird most recent (not the second most recent as was the case in theprevious example) interaction identifier. In this example, the thirdmost recent interaction identifier is evaluated since that positionwould contain the interaction identifier generated by service 2500 inthe illustrated embodiment. If the call graph generation logicdetermines that the most recent interaction identifier of requestidentifier 2502 matches the third most recent interaction identifier ofrequest identifier 2542, the call graph generation logic may determinethat service 2500 called service 2510 even if the log data for service2510 is unavailable (e.g., due to data loss). Accordingly, the callgraph generation logic may indicate an edge (representing a servicecall) exists between service 2500 and service 2510 within the generatedcall graph data structure.

In addition to the request identifiers described above, metadatarelating to service interactions may be collected (e.g., by the logreporting agent 2350) and used in the generation of call graphs. Invarious embodiments, the metadata includes, but is not limited to, anyof the following: a timestamp, an indication of whether the interactionis on the client side or server side, the name or other identifier ofthe application programming interface (API) invoked for the interaction,the host name, data that describes the environment (e.g., a versionnumber of a production environment or test environment), and/or anyother metadata that is suitable for building the call graphs and/orcomparing one set of call graphs to another. The collected metadata maybe used to determine a graph of service interactions, i.e., byidentifying or distinguishing nodes and edges from other nodes andedges. If the metadata includes information identifying a test runand/or the version of an environment, then the metadata may enablereporting of test results (e.g., test coverage metrics and/or reports)by test run and/or environment.

In some embodiments, various metadata may also be included within suchcall graph data structure, such as timestamps, the particular quantum ofwork performed in response to a given request, and/or any errorsencountered while processing a given request. For example, theillustrated services may record timestamps of when a request isreceived, when a request is generated, and/or when a request is sent toanother service. These timestamps may be appended to the call graph datastructure to designate latency times between services (e.g., bycalculating the time difference between when a request is sent and whenit is received). In other cases, metadata may include error informationthat indicates any errors encountered or any tasks performed whileprocessing a given request. In some embodiments, such metadata mayinclude host address (e.g., an Internet Protocol address of a host) inorder to generate a graph structure that indicates which host machinesare processing requests (note that in some embodiments host machines mayhost multiple different services).

The system and method for tracking service requests described herein maybe configured to perform a variety of methods. The call graph generationlogic described herein may be configured to receive multiple requestidentifiers, each associated with a respective one of multiple servicerequests. Each given request identifier may include an origin identifierassociated with a root request, a depth value specifying a location ofthe associated service request within a sequence of service requests,and a request stack including one or more interaction identifiersassigned to a service request issued from one service to anotherservice. For example, receiving multiple request identifiers may in somecases include receiving log data that includes such request identifiers.For instance, the call graph generation logic may receive log datadirectly from host systems that host the services of theservice-oriented system described herein. In some cases, the call graphgeneration logic may receive log data from one or more log repositoriessuch as log repository 2410 described above. In general, the call graphgeneration logic may utilize any of the techniques for obtaining requestidentifiers described above with respect to call graph generation logic2420.

The call graph generation logic may further, based on multiple ones ofthe request identifiers that each include an origin identifierassociated with a particular root request, generate a data structurethat specifies a hierarchy of services called to fulfill that particularroot request; wherein, based on one or more of the interactionidentifiers and one or more of the depth values, the generated datastructure specifies, for a given service of said hierarchy: a parentservice that called the given service, and one or more child servicescalled by the given service. For example, in various embodiments,generating the data structure may include determining that each of asubset of the multiple request identifiers includes the same originidentifier as well as indicating each associated service request as anode of the hierarchy within the data structure. Examples of such nodesare illustrated in FIG. 25 as services 2500, 2510, 2520, 2530, 2540,2550 and 2560. Generating such data structure may also include, for eachnode within the hierarchy, assigning the node to a level within thehierarchy based on the transaction depth value of the request identifierassociated with the service request corresponding to that node. Examplesof such depth level values are described above with respect totransaction depth 2120 of FIG. 21. Generating the data structure mayalso include determining that the request stack of a given node at agiven level within the hierarchy includes an interaction identifier thatis the same as an interaction identifier of the request stack of anothernode located within an adjacent level of the hierarchy. In response todetermining such match, the call graph generation logic may indicate aservice call as an edge between said given node and said other node.Examples of such an edge are illustrated as the edges coupling the nodesof FIG. 25 described above.

In various embodiments, the techniques for analyzing request identifiersand generating a call graph may be performed on an incremental basis.For example, as request identifiers are updated (e.g., as logs and/orlog repositories receive new data), the call graph generation logicdescribed herein may be configured to incrementally update the generatedcall graph data structure to reflect the newly reported requests. Insome embodiments, the techniques described herein may be performed on adepth-level basis. For example, as request identifiers are received(e.g., by the log repository or call graph generation logic describedherein), each identifier may be categorized (e.g., placed in acategorized directory) based on transaction depth.

In various embodiments, the generated call graph data structuresdescribed herein may be utilized for diagnostic purposes. For instance,as described above, the call graph data structure may include metadata,such as a record of error(s) that occur when processing a request.Because this metadata may be associated with specific nodes and/orservice calls, various embodiments may include determining sources oferrors or faults within the service-oriented system. In someembodiments, the generated call graph data structures described hereinmay be utilized for analytical purposes. For example, based on callgraph data structures generated as described herein, various embodimentsmay include determining historical paths of service calls and/or pathanomalies. For instance, various embodiments may include detecting that,for a given root request, one or more services are being calledunnecessarily. For instance, such services may not be needed to fulfillthe particular root request. Accordingly, in some embodiments, suchservices may be culled from processing further requests similar to orthe same as the root request that originally initiated the unnecessaryservice calls (e.g., a re-orchestration process may be employed tomodify the particular services called for a particular type of request).By removing such unnecessary service calls, various embodiments mayconserve resources such as storage and/or bandwidth. In otherembodiments, the generated call graph data structures described hereinmay be utilized for auditing purposes. For example, in the case that theservice oriented system provides network-based services (e.g., webservices) to consumers of such services (who may provide remunerationfor the consumption of services), such consumers may desire to at leastoccasionally view information that confirms they are being charged in afair manner. To provide such information to the consumer, variousembodiments may include providing the consumer with various records suchas records that indicate how frequent they consume network-basedservices and in what quantity. Such information may be generated basedon the call graph data structures described herein.

In one embodiment, the call graph generation logic may receive a firstrequest identifier associated with an inbound service request. Therequest identifier may include an origin identifier associated with aroot request, a depth value specifying a location of the inbound servicerequest within a sequence of service requests, and a request stackincluding multiple interaction identifiers each assigned to a respectiveservice request issued from one service to another service of multipleservices. One example of receiving such a request identifier isillustrated in FIG. 23 as the receipt of inbound service requestidentifier 2240 by service 2300.

The call graph generation logic may also generate a new request stack.The new request stack may include all of the interaction identifiers ofthe first request identifier except for an oldest one of the interactionidentifiers. For instance, as illustrated in FIG. 23, the request stackof outbound request identifier 2250 does not include “6F,” which is theoldest interaction identifier of the inbound service request identifier2240. The new request stack may also include a new interactionidentifier associated with an outbound service request. For instance, asillustrated in FIG. 23, the request stack of outbound service requestidentifier 2250 includes a new interaction identifier “2C.”

The call graph generation logic may also generate a second requestidentifier associated with the outbound service request. The secondrequest identifier may include the origin identifier, a new depth valuespecifying a location of the outbound service request within thesequence of service requests, and the new request stack. One example ofsuch a second request identifier is illustrated as outbound servicerequest identifier 2250 of FIG. 23.

In various embodiments, the call graph generation logic may alsogenerate the new depth value such that the new depth value is a resultof incrementing the first depth value. For example, in the illustratedembodiment of FIG. 23, the depth value of the outbound requestidentifier (i.e., “4”) may be the result of incrementing the depth valueof the inbound request identifier (i.e., “3”). In various embodiments,the call graph generation logic may store either of (or both of) thefirst request identifier and the second request identifier as log dataaccessible to one or more computer systems. For instance, in theillustrated embodiment of FIG. 23, the inbound and outbound requestidentifiers may be stored in inbound request log 2330 and outboundrequest log 2340, respectively.

For each of the interactions between the services 2500, 2510, 2520,2530, 2540, 2550, and 250, a request path or downstream path is shown.For each of the interactions between the services 2500, 2510, 2520,2530, 2540, 2550, and 250, a reply path or upstream path is also shown.In response to each request, the recipient (i.e., downstream) servicemay send a reply to the requesting (i.e., upstream) service at anyappropriate point in time, e.g., after completing the requestedoperation and receiving replies for any further downstream servicescalled to satisfy the request. A terminal downstream service (i.e., aservice that calls no further services) may send a reply to theimmediately upstream service upon completion of the requested operationor upon encountering an error that prevents completion of the requestedoperation. A reply may include any suitable data and/or metadata, suchas the output of a requested service in the reply path and/or any errorcodes or condition codes experienced in the reply path. A reply may alsoinclude any suitable element(s) of identifying information from therequest stack of the corresponding request, such as the originidentifier and/or interaction identifiers shown in FIG. 21.

One example system configuration for tracking service requests isillustrated in FIG. 26. As illustrated, the various components of theexample system are coupled together via a network 2180. Network 2180 mayinclude any combination of local area networks (LANs), wide areanetworks (WANs), some other network configured to communicate datato/from computer systems, or some combination thereof. Each of hostsystems 2700 a-c and 2720 may be implemented by a computer system, suchas computer system 3000 described below. Call graph generation logic2420 may be implemented as software (e.g., program instructionsexecutable by a processor of host system 2720), hardware, or somecombination thereof. Call graph data structures 2430 may be generated byhost system logic 420 and stored in a memory of host system 2720. Logrepository 2410 may be implemented as a data store (e.g., database,memory, or some other element configured to store data) coupled tonetwork 2180. In other embodiments, log repository 2410 may beimplemented as a backend system of host system 2720 and accessible tohost system 2720 via a separate network. Host system 2700 a may beconfigured to execute program instruction to implement one or moreservices 2750 a. Such services may include but are not limited to one ormore of network-based services (e.g., a web service), applications,functions, objects, methods (e.g., objected-oriented methods),subroutines, or any other set of computer-executable instructions.Examples of services 2750 include any of the services described above.Host systems 2700 b-c and services 2750 b-c may be configured in asimilar manner.

In various embodiments, the various services of the illustratedembodiment may be controlled by a common entity. However, in someembodiments, external systems, such as a system controlled by anotherentity, may be called as part of a sequence of requests for fulfilling aroot request. In some cases, the external system may adhere to therequest identifier generation techniques described herein and mayintegrate with the various services described above. In the event thatan external system does not adhere to the various techniques forgenerating request identifiers as described herein, the external systemmay be treated as a service that is not visible in the call graph or,alternatively, requests sent back from the external system may betreated as new requests altogether (e.g., as root requests). In variousembodiments, the system configuration may include one or more proxysystems and/or load balancing systems. In some cases, the systemconfiguration may treat these systems as transparent from a requestidentifier generation perspective. In other cases, these systems maygenerate request identifiers according to the techniques describedabove.

In some embodiments, the service-oriented system described herein may beintegrated with other external systems that may utilize differenttechniques for identifying requests. For instance, the requestidentifiers described herein may in various embodiments be wrapped orenveloped in additional data (e.g., additional identifiers, headers,etc.) to facilitate compatibility with various external systems.

Containerization

FIG. 27 is a software architecture diagram illustrating thecontainerization of various types of program components, according tosome embodiments. The program components of a distributed program,including services in a service-oriented system, might be containerizedin order to provide flexibility in locating the program components inthe distributed execution environment for efficient execution.Containerization refers to a process of integrating one or more programcomponents within an appropriate and re-locatable execution environment.As shown in FIG. 27, various types of executable programs 2820A and2820B might be containerized into other types of deployment packages2822 for deployment and execution on a physical compute instance 2824 ora virtual compute instance (or virtual machine) 2826. For instance, JAVAprograms that typically execute in separate JAVA virtual machines(“JVMs”) might be placed in a containerized JVM for execution.

An optimization component (e.g., the optimizer 180) might determine thatone or more program components of the distributed program (e.g., one ormore services) should be containerized in order to optimize for themetrics specified by a developer of the distributed program. In responsethereto, the optimization component might work in conjunction with othercomponents to perform the containerization. The optimization componentmight then operate with the deployment component to deploy thecontainerized program component to a server computer selected tooptimize the execution of the distributed program that utilizes thecontainerized program component. The server computer to which the JVM isdeployed might be selected to maximize the efficiency of execution ofthe JAVA programs in the context of the entire distributed program andthe metrics and constraints specified by the developer of thedistributed program.

In a similar fashion, the JAVASCRIPT programs, which ordinarily executein separate JAVASCRIPT engines, might be containerized into acontainerized JAVASCRIPT engine. Containerizing in this fashion providessignificant flexibility in selecting a server for executing theJAVASCRIPT programs. It should be appreciated, however, thatcontainerization of program components in the manner presented above isnot limited to JAVA and JAVASCRIPT programs. For instance, executableC++ programs that typically execute in separate virtual machines mightbe containerized into a containerized virtual machine for execution.

Once the program components have been containerized, the containers canbe deployed to locations in the distributed computing environment inorder to optimize for the metrics and constraints specified by thedeveloper of the distributed program. For instance, containers may belocated close together (e.g., on the same server, in the same rack ofservers, or in the same data center) when possible to reduce latency anddata movement between the containerized programs. Similarly,containerized programs might be placed close together or close todependent resources in order to eliminate or reduce remote networkcalls. Other types of optimizations might also be performed oncontainerized and non-containerized program components.

Illustrative Computer System

In at least some embodiments, a computer system that implements aportion or all of one or more of the technologies described herein mayinclude a general-purpose computer system that includes or is configuredto access one or more computer-readable media. FIG. 28 illustrates sucha general-purpose computing device 3000. In the illustrated embodiment,computing device 3000 includes one or more processors 3010 coupled to asystem memory 3020 via an input/output (I/O) interface 3030. Computingdevice 3000 further includes a network interface 3040 coupled to I/Ointerface 3030.

In various embodiments, computing device 3000 may be a uniprocessorsystem including one processor 3010 or a multiprocessor system includingseveral processors 3010 (e.g., two, four, eight, or another suitablenumber). Processors 3010 may include any suitable processors capable ofexecuting instructions. For example, in various embodiments, processors3010 may be general-purpose or embedded processors implementing any of avariety of instruction set architectures (ISAs), such as the x86,PowerPC, SPARC, or MIPS ISAs, or any other suitable ISA. Inmultiprocessor systems, each of processors 3010 may commonly, but notnecessarily, implement the same ISA.

System memory 3020 may be configured to store program instructions anddata accessible by processor(s) 3010. In various embodiments, systemmemory 3020 may be implemented using any suitable memory technology,such as static random access memory (SRAM), synchronous dynamic RAM(SDRAM), nonvolatile/Flash-type memory, or any other type of memory. Inthe illustrated embodiment, program instructions and data implementingone or more desired functions, such as those methods, techniques, anddata described above, are shown stored within system memory 3020 as code(i.e., program instructions) 3025 and data 3026.

In one embodiment, I/O interface 3030 may be configured to coordinateI/O traffic between processor 3010, system memory 3020, and anyperipheral devices in the device, including network interface 3040 orother peripheral interfaces. In some embodiments, I/O interface 3030 mayperform any necessary protocol, timing or other data transformations toconvert data signals from one component (e.g., system memory 3020) intoa format suitable for use by another component (e.g., processor 3010).In some embodiments, I/O interface 3030 may include support for devicesattached through various types of peripheral buses, such as a variant ofthe Peripheral Component Interconnect (PCI) bus standard or theUniversal Serial Bus (USB) standard, for example. In some embodiments,the function of I/O interface 3030 may be split into two or moreseparate components, such as a north bridge and a south bridge, forexample. Also, in some embodiments some or all of the functionality ofI/O interface 3030, such as an interface to system memory 3020, may beincorporated directly into processor 3010.

Network interface 3040 may be configured to allow data to be exchangedbetween computing device 3000 and other devices 3060 attached to anetwork or networks 3050. In various embodiments, network interface 3040may support communication via any suitable wired or wireless generaldata networks, such as types of Ethernet network, for example.Additionally, network interface 3040 may support communication viatelecommunications/telephony networks such as analog voice networks ordigital fiber communications networks, via storage area networks such asFibre Channel SANs, or via any other suitable type of network and/orprotocol.

In some embodiments, system memory 3020 may be one embodiment of acomputer-readable (i.e., computer-accessible) medium configured to storeprogram instructions and data as described above for implementingembodiments of the corresponding methods and apparatus. However, inother embodiments, program instructions and/or data may be received,sent or stored upon different types of computer-readable media.Generally speaking, a computer-readable medium may includenon-transitory storage media or memory media such as magnetic or opticalmedia, e.g., disk or DVD/CD coupled to computing device 3000 via I/Ointerface 3030. A non-transitory computer-readable storage medium mayalso include any volatile or non-volatile media such as RAM (e.g. SDRAM,DDR SDRAM, RDRAM, SRAM, etc.), ROM, etc, that may be included in someembodiments of computing device 3000 as system memory 3020 or anothertype of memory. Further, a computer-readable medium may includetransmission media or signals such as electrical, electromagnetic, ordigital signals, conveyed via a communication medium such as a networkand/or a wireless link, such as may be implemented via network interface3040. Portions or all of multiple computing devices such as thatillustrated in FIG. 28 may be used to implement the describedfunctionality in various embodiments; for example, software componentsrunning on a variety of different devices and servers may collaborate toprovide the functionality. In some embodiments, portions of thedescribed functionality may be implemented using storage devices,network devices, or special-purpose computer systems, in addition to orinstead of being implemented using general-purpose computer systems. Theterm “computing device,” as used herein, refers to at least all thesetypes of devices, and is not limited to these types of devices.

Embodiments of the disclosure can be described in view of the followingclauses:

Clause 1. A system, comprising:

-   -   a plurality of computing devices configured to implement an        optimization system and a service-oriented system, wherein the        service-oriented system comprises a plurality of services,        wherein the plurality of services are configured to:        -   generate trace data for a plurality of service interactions            between individual ones of the plurality of services,            wherein the trace data comprises data indicative of network            latency for the plurality of service interactions; and        -   send the trace data to the optimization system; and    -   wherein the optimization system is configured to:        -   determine an optimized configuration for the            service-oriented system, wherein the optimized configuration            reduces a total network latency for one or more service            interactions in the service-oriented system;        -   generate a partial service based on an original service of            the plurality of services, wherein the partial service is            generated based on an automatic analysis of program code of            the original service, wherein the partial service includes a            first set of program code from the original service and            excludes a second set of program code from the original            service, and wherein the first set of program code is            included in the partial service based on a frequency of use            of the first set of program code; and        -   cause deployment of one or more instances of the partial            service based on the optimized configuration.

Clause 2. The system as recited in clause 1, wherein, in causingdeployment of one or more instances of the partial service based on theoptimized configuration, the optimization system is configured to:

-   -   cause deployment of one or more instances of the partial service        to one or more of the computing devices in a same zone as one or        more of the services that interact with the original service;    -   cause deployment of one or more instances of the partial service        to one or more of the computing devices that host one or more of        the services that interact with the original service;    -   cause deployment of one or more instances of the partial service        to one or more virtual machines that host one or more of the        services that interact with the original service; or    -   cause deployment of one or more instances of the partial service        to one or more processes that host one or more of the services        that interact with the original service.

Clause 3. The system as recited in clause 1 or 2, wherein the optimizedconfiguration for the service-oriented system is determined based onperformance data for individual ones of the plurality of services, basedon static analysis of program code for individual ones of the pluralityof services, or based on the performance data for individual ones of theplurality of services and on the static analysis of the program code forindividual ones of the plurality of services.

Clause 4. The system as recited in any of clauses 1 to 3, wherein, inperforming the automatic analysis of the program code of the originalservice, the optimization system is configured to:

-   -   determine one or more parameters passed to the original service        by one or more of the plurality of services that interact with        the original service; and    -   partially evaluate the program code of the original service        using the one or more parameters.

Clause 5. A computer-implemented method, comprising:

-   -   generating a partial service based on an original service in a        service-oriented system, wherein the partial service is        generated based on an automatic analysis of program code of the        original service, wherein the partial service includes a first        set of program code from the original service and excludes a        second set of program code from the original service, and        wherein the first set of program code is included in the partial        service based on a frequency of use of the first set of program        code; and    -   causing deployment of one or more instances of the partial        service to the service-oriented system based on an optimized        configuration, wherein the optimized configuration improves a        total performance metric in the service-oriented system.

Clause 6. The method as recited in clause 5, wherein causing deploymentof one or more instances of the partial service to the service-orientedsystem based on the optimized configuration comprises:

-   -   causing deployment of one or more instances of the partial        service to one or more computing devices in a same zone as one        or more services that interact with the original service.

Clause 7. The method as recited in clause 5 or 6, wherein causingdeployment of one or more instances of the partial service to theservice-oriented system based on the optimized configuration comprises:

-   -   causing deployment of one or more instances of the partial        service to one or more computing devices that host one or more        services that interact with the original service.

Clause 8. The method as recited in any of clauses 5 to 7, wherein theautomatic analysis of the program code of the original service, thegenerating the partial service based on the original service, and thecausing deployment of the one or more instances of the partial serviceare performed a plurality of times over an interval of time.

Clause 9. The method as recited in any of clauses 5 to 8, furthercomprising:

-   -   determining the optimized configuration for the service-oriented        system based on performance data for a plurality of services,        based on static analysis of program code for the plurality of        services, or based on the performance data for the plurality of        services and on the static analysis of the program code for the        plurality of services.

Clause 10. The method as recited in any of clauses 5 to 9, whereinperforming the automatic analysis of the program code of the originalservice comprises:

-   -   determining one or more parameters passed to the original        service by one or more services that interact with the original        service; and    -   partially evaluating the program code of the original service        using the one or more parameters.

Clause 11. The method as recited in any of clauses 5 to 10, wherein theone or more parameters are determined based on trace data for aplurality of service interactions between the original service and theone or more services that interact with the original service.

Clause 12. The method as recited in any of clauses 5 to 11, whereingenerating the partial service based on the original service comprises:

-   -   substituting, for the second set of program code, a service call        to an additional service that implements the second set of        program code.

Clause 13. A computer-readable storage medium storing programinstructions computer-executable to perform:

-   -   collecting trace data for a plurality of service interactions        between individual ones of a plurality of services in a        service-oriented system;    -   determining an optimized configuration for the service-oriented        system based on the trace data;    -   generating a partial service based on an original service in the        service-oriented system, wherein the partial service is        generated based on an automatic analysis of program code of the        original service, wherein the partial service includes a first        set of program code from the original service and excludes a        second set of program code from the original service, and        wherein the first set of program code is included in the partial        service based on a frequency of use of the first set of program        code; and    -   causing deployment of one or more instances of the partial        service to the service-oriented system based on the optimized        configuration.

Clause 14. The computer-readable storage medium as recited in clause 13,wherein, in causing deployment of one or more instances of the partialservice to the service-oriented system based on the optimizedconfiguration, the program instructions are further computer-executableto perform:

-   -   causing deployment of one or more instances of the partial        service to one or more computing devices in a same zone as one        or more services that interact with the original service.

Clause 15. The computer-readable storage medium as recited in clause 13or 14, wherein, in causing deployment of one or more instances of thepartial service to the service-oriented system based on the optimizedconfiguration, the program instructions are further computer-executableto perform:

-   -   causing deployment of one or more instances of the partial        service to one or more computing devices that host one or more        services that interact with the original service.

Clause 16. The computer-readable storage medium as recited in any ofclauses 13 to 15, wherein the automatic analysis of the program code ofthe original service, the generating the partial service based on theoriginal service, and the causing deployment of the one or moreinstances of the partial service are performed a plurality of times overan interval of time.

Clause 17. The computer-readable storage medium as recited in any ofclauses 13 to 16, wherein the optimized configuration for theservice-oriented system is determined based on performance data for aplurality of services, based on static analysis of program code for theplurality of services, or based on the performance data for theplurality of services and on the static analysis of the program code forthe plurality of services.

Clause 18. The computer-readable storage medium as recited in any ofclauses 13 to 17, wherein, in performing the automatic analysis of theprogram code of the original service, the program instructions arefurther computer-executable to perform:

-   -   determining one or more parameters passed to the original        service by one or more services that interact with the original        service; and    -   partially evaluating the program code of the original service        using the one or more parameters.

Clause 19. The computer-readable storage medium as recited in any ofclauses 13 to 18, wherein the one or more parameters are determinedbased on trace data for a plurality of service interactions between theoriginal service and the one or more services that interact with theoriginal service.

Clause 20. The computer-readable storage medium as recited in any ofclauses 13 to 19, wherein, in generating the partial service based onthe original service, the program instructions are furthercomputer-executable to perform:

-   -   substituting, for the second set of program code, a service call        to an additional service that implements the second set of        program code.

Clause 21. A system, comprising:

-   -   a plurality of computing devices configured to implement an        optimization system and a service-oriented system, wherein the        service-oriented system comprises a plurality of services,        wherein the plurality of services are configured to:        -   generate trace data for a plurality of service interactions            between individual ones of the plurality of services,            wherein the trace data comprises data indicative of network            latency for the plurality of service interactions; and        -   send the trace data to the optimization system; and    -   wherein the optimization system is configured to:        -   determine an optimized configuration for the            service-oriented system based on the trace data; and        -   cause relocation of one or more of the plurality of services            to one or more edge hosts based on the optimized            configuration, wherein the relocation improves a total            performance metric for one or more service interactions            involving the one or more relocated services on the one or            more edge hosts.

Clause 22. The system as recited in clause 21, wherein the optimizationsystem is configured to:

-   -   cause an additional relocation of one or more of the plurality        of services to one or more of the client devices based on the        optimized configuration, wherein the additional relocation        improves a total performance metric for one or more service        interactions involving the one or more client devices.

Clause 23. The system as recited in clause 21 or 22, wherein theoptimization system is configured to:

-   -   generate a partial service based on an original service of the        plurality of services, wherein the partial service includes a        first set of program code from the original service and excludes        a second set of program code from the original service, and        wherein the first set of program code is included in the partial        service based on a frequency of use of the first set of program        code;    -   wherein, in causing the relocation of one or more of the        plurality of services to the one or more edge hosts based on the        optimized configuration, the optimization system is configured        to cause relocation of the partial service to the one or more        edge hosts based on the optimized configuration.

Clause 24. The system as recited in any of clauses 21 to 23, wherein oneor more content delivery networks comprise the one or more edge hosts.

Clause 25. A computer-implemented method, comprising:

-   -   determining an optimized configuration for a service-oriented        system based on trace data for a plurality of service        interactions between individual ones of a plurality of services        in the service-oriented system; and    -   causing relocation of one or more of the plurality of services        to or from one or more edge hosts based on the optimized        configuration, wherein the relocation improves a total        performance metric for one or more service interactions        involving the one or more edge hosts.

Clause 26. The method as recited in clause 25, further comprising:

-   -   causing an additional relocation of one or more of the plurality        of services to or from one or more of the client devices based        on the optimized configuration, wherein the additional        relocation improves a total performance metric for one or more        service interactions involving the one or more client devices.

Clause 27. The method as recited in clause 25 or 26, further comprising:

-   -   generating a partial service based on an original service of the        plurality of services, wherein the partial service includes a        first set of program code from the original service and excludes        a second set of program code from the original service, and        wherein the first set of program code is included in the partial        service based on a frequency of use of the first set of program        code;    -   wherein causing the relocation of one or more of the plurality        of services to or from the one or more edge hosts based on the        optimized configuration comprises causing relocation of the        partial service to or from the one or more edge hosts based on        the optimized configuration.

Clause 28. The method as recited in any of clauses 25 to 27, wherein oneor more content delivery networks comprise the one or more edge hosts.

Clause 29. The method as recited in any of clauses 25 to 28, wherein thetrace data comprises data indicative of network latency for theplurality of service interactions.

Clause 30. The method as recited in any of clauses 25 to 29, furthercomprising:

-   -   translating program code for the relocated one or more services        to a format executable on the one or more edge hosts.

Clause 31. The method as recited in any of clauses 25 to 30, wherein theoptimized configuration is determined based on an estimated cost ofexecuting the relocated one or more services on the one or more edgehosts.

Clause 32. The method as recited in any of clauses 25 to 31, wherein theoptimized configuration is determined based on a security risk analysisof executing the relocated one or more services on the one or more edgehosts.

Clause 33. A computer-readable storage medium storing programinstructions computer-executable to perform:

-   -   collecting trace data for a plurality of service interactions        between individual ones of a plurality of services in a        service-oriented system;    -   determining an optimized configuration for the service-oriented        system based on the trace data; and    -   causing relocation of one or more of the plurality of services        to one or more edge hosts based on the optimized configuration,        wherein the relocation improves a total performance metric for        one or more service interactions involving the one or more edge        hosts.

Clause 34. The computer-readable storage medium as recited in clause 33,wherein the program instructions are further computer-executable toperform:

-   -   causing an additional relocation of one or more of the plurality        of services to one or more of the client devices based on the        optimized configuration, wherein the additional relocation        improves a total performance metric for one or more service        interactions involving the one or more client devices.

Clause 35. The computer-readable storage medium as recited in clause 33or 34, wherein the program instructions are further computer-executableto perform:

-   -   generating a partial service based on an original service of the        plurality of services, wherein the partial service includes a        first set of program code from the original service and excludes        a second set of program code from the original service, and        wherein the first set of program code is included in the partial        service based on a frequency of use of the first set of program        code;    -   wherein causing the relocation of one or more of the plurality        of services to the one or more edge hosts based on the optimized        configuration comprises causing relocation of the partial        service to the one or more edge hosts based on the optimized        configuration.

Clause 36. The computer-readable storage medium as recited in any ofclauses 33 to 35, wherein one or more content delivery networks comprisethe one or more edge hosts.

Clause 37. The computer-readable storage medium as recited in any ofclauses 33 to 36, wherein the trace data comprises data indicative ofnetwork latency for the plurality of service interactions.

Clause 38. The computer-readable storage medium as recited in any ofclauses 33 to 37, wherein the program instructions are furthercomputer-executable to perform:

-   -   translating program code for the relocated one or more services        to a format executable on the one or more edge hosts.

Clause 39. The computer-readable storage medium as recited in any ofclauses 33 to 38, wherein the optimized configuration is determinedbased on an estimated cost of executing the relocated one or moreservices on the one or more edge hosts.

Clause 40. The computer-readable storage medium as recited in any ofclauses 33 to 39, wherein the program instructions are furthercomputer-executable to perform:

-   -   determining a further optimized configuration for the        service-oriented system based on additional trace data for a        plurality of additional service interactions in the        service-oriented system; and    -   causing an additional relocation of individual ones of the        relocated one or more services from the one or more edge hosts        to one or more hosts in the service-oriented system, wherein the        additional relocation is performed based on the further        optimized configuration.

Clause 41. A system, comprising:

-   -   a plurality of computing devices configured to implement an        optimization system and a service-oriented system, wherein the        service-oriented system comprises a plurality of services,        wherein the plurality of services are configured to:        -   generate trace data for a plurality of service interactions            between individual ones of the plurality of services,            wherein the trace data comprises data indicative of network            latency for the plurality of service interactions; and        -   send the trace data to the optimization system; and    -   wherein the optimization system is configured to:        -   determine an optimized configuration for the            service-oriented system based on the trace data; and        -   cause relocation of one or more of the plurality of services            to one or more client devices based on the optimized            configuration, wherein the relocation improves a total            performance metric for one or more service interactions            involving the one or more relocated services on the one or            more client devices.

Clause 42. The system as recited in clause 41, wherein the optimizationsystem is configured to:

-   -   cause an additional relocation of one or more of the plurality        of services to one or more edge hosts based on the optimized        configuration, wherein the additional relocation improves a        total performance metric for one or more service interactions        involving the one or more edge hosts.

Clause 43. The system as recited in clause 41 or 42, wherein theoptimization system is configured to:

-   -   generate a partial service based on an original service of the        plurality of services, wherein the partial service includes a        first set of program code from the original service and excludes        a second set of program code from the original service, and        wherein the first set of program code is included in the partial        service based on a frequency of use of the first set of program        code;    -   wherein, in causing the relocation of one or more of the        plurality of services to one or more client devices based on the        optimized configuration, the optimization system is configured        to cause relocation of the partial service to the one or more        client devices based on the optimized configuration.

Clause 44. The system as recited in any of clauses 41 to 43, wherein theoptimization system is configured to:

-   -   translate program code for the relocated one or more services to        a format executable on the one or more client devices.

Clause 45. A computer-implemented method, comprising:

-   -   determining an optimized configuration for a service-oriented        system based on trace data for a plurality of service        interactions between individual ones of a plurality of services        in the service-oriented system; and    -   causing relocation of one or more of the plurality of services        to or from one or more client devices based on the optimized        configuration, wherein the relocation improves a total        performance metric for one or more service interactions        involving the one or more client devices.

Clause 46. The method as recited in clause 45, further comprising:

-   -   causing an additional relocation of one or more of the plurality        of services to or from one or more edge hosts based on the        optimized configuration, wherein the additional relocation        improves a total performance metric for one or more service        interactions involving the one or more edge hosts.

Clause 47. The method as recited in clause 45 or 46, wherein one or morecontent delivery networks comprise the one or more edge hosts.

Clause 48. The method as recited in any of clauses 45 to 47, wherein thetrace data comprises data indicative of network latency for theplurality of service interactions.

Clause 49. The method as recited in any of clauses 45 to 48, furthercomprising:

-   -   translating program code for the relocated one or more services        to a format executable on the one or more client devices.

Clause 50. The method as recited in any of clauses 45 to 49, wherein theoptimized configuration is determined based on an estimated cost ofexecuting the relocated one or more services on the one or more clientdevices.

Clause 51. The method as recited in any of clauses 45 to 50, wherein theoptimized configuration is determined based on a security risk analysisof executing the relocated one or more services on the one or moreclient devices.

Clause 52. The method as recited in clause any of clauses 45 to 51,further comprising:

-   -   enabling a first portion of program code for individual ones of        the relocated one or more services and disabling a second        portion of program code for individual ones of the relocated one        or more services on the one or more client devices.

Clause 53. A computer-readable storage medium storing programinstructions computer-executable to perform:

-   -   collecting trace data for a plurality of service interactions        between individual ones of a plurality of services in a        service-oriented system;    -   determining an optimized configuration for the service-oriented        system based on the trace data; and    -   causing relocation of one or more of the plurality of services        to one or more client devices based on the optimized        configuration, wherein the relocation improves a total        performance metric for one or more service interactions on the        one or more client devices.

Clause 54. The computer-readable storage medium as recited in clause 53,wherein the program instructions are further computer-executable toperform:

-   -   causing an additional relocation of one or more of the plurality        of services to one or more edge hosts based on the optimized        configuration, wherein the additional relocation improves a        total performance metric for one or more service interactions        involving the one or more edge hosts.

Clause 55. The computer-readable storage medium as recited in clause 53or 54, wherein one or more content delivery networks comprise the one ormore edge hosts.

Clause 56. The computer-readable storage medium as recited in any ofclauses 53 to 55, wherein the trace data comprises data indicative ofnetwork latency for the plurality of service interactions.

Clause 57. The computer-readable storage medium as recited in any ofclauses 53 to 56, wherein the program instructions are furthercomputer-executable to perform:

-   -   translating program code for the relocated one or more services        to a format executable on the one or more client devices.

Clause 58. The computer-readable storage medium as recited in any ofclauses 53 to 57, wherein the optimized configuration is determinedbased on an estimated cost of executing the relocated one or moreservices on the one or more client devices.

Clause 59. The computer-readable storage medium as recited in any ofclauses 53 to 58, wherein the program instructions are furthercomputer-executable to perform:

-   -   determining a further optimized configuration for the        service-oriented system based on additional trace data for a        plurality of additional service interactions in the        service-oriented system; and    -   causing an additional relocation of individual ones of the        relocated one or more services from the one or more client        devices to one or more hosts in the service-oriented system,        wherein the additional relocation is performed based on the        further optimized configuration.

Clause 60. The computer-readable storage medium as recited in any ofclauses 53 to 59, wherein the program instructions are furthercomputer-executable to perform:

-   -   enabling a first portion of program code for individual ones of        the relocated one or more services and disabling a second        portion of program code for individual ones of the relocated one        or more services on the one or more client devices.

Clause 61. A system, comprising:

-   -   a plurality of computing devices configured to implement an        optimization system and a service-oriented system, wherein the        service-oriented system comprises a plurality of services,        wherein the plurality of services are configured to:        -   generate trace data for a plurality of service interactions            between individual ones of the plurality of services,            wherein the trace data comprises data indicative of call            paths, performance metrics, or call paths and performance            metrics for the plurality of service interactions; and        -   send the trace data to the optimization system; and    -   wherein the optimization system is configured to:        -   determine a respective cost of individual ones of a            plurality of configuration options in the service-oriented            system;        -   determine an optimized configuration for the            service-oriented system based on the respective costs and            the trace data, wherein the optimized configuration            comprises a selection of one or more of the plurality of            configuration options, and wherein the optimized            configuration improves at least one performance metric, at            least one cost, or at least one performance metric and at            least one cost across at least a portion of the            service-oriented system; and        -   cause deployment of the optimized configuration to the            service-oriented system, wherein the deployment of the            optimized configuration comprises modification of a            configuration of a cache, modification of a location of a            data source or a location of a service that uses the data            source, modification of a configuration for service            parallelization, or modification of a configuration for            response precomputation.

Clause 62. The system as recited in clause 61, wherein the deployment ofthe optimized configuration comprises modification of a configuration ofa cache or a location of a data source for a service whose program codedoes not specify usage of the cache or the data source.

Clause 63. The system as recited in clause 61 or 62, wherein theoptimized configuration is determined based on an automated optimizationprocess.

Clause 64. The system as recited in any of clauses 61 to 63, wherein theoptimization system is further configured to:

-   -   refine the optimized configuration for the service-oriented        system a plurality of times over an interval of time.

Clause 65. A computer-implemented method, comprising:

-   -   receiving trace data for a plurality of service interactions        between individual ones of a plurality of services in a        service-oriented system;    -   receiving a respective cost of individual ones of a plurality of        configuration options in the service-oriented system;    -   determining an optimized configuration for the service-oriented        system based on the respective costs and the trace data, wherein        the optimized configuration is determined based on an automated        optimization process, and wherein the optimized configuration        comprises a selection of one or more of the plurality of        configuration options; and    -   causing deployment of the optimized configuration to the        service-oriented system.

Clause 66. The method as recited in clause 65, wherein the plurality ofconfiguration options comprise a plurality of cache configurationoptions, and wherein the optimized configuration comprises a selectionof one or more of the cache configuration options.

Clause 67. The method as recited in clause 65 or 66, wherein thedeployment of the optimized configuration comprises modification of aconfiguration of a cache or a location of a data source for a servicewhose program code does not specify usage of the cache or the datasource.

Clause 68. The method as recited in any of clauses 65 to 67, wherein theplurality of configuration options comprise a plurality of options forbatch accumulation for a plurality of service calls to a remote node,and wherein the optimized configuration comprises a selection of one ormore of the options for batch accumulation.

Clause 69. The method as recited in any of clauses 65 to 68, wherein theplurality of configuration options comprise a plurality of data locationoptions, and wherein the optimized configuration comprises a selectionof one or more of the data location options.

Clause 70. The method as recited in any of clauses 65 to 69, wherein theplurality of configuration options comprise a plurality of serviceparallelization options, and wherein the optimized configurationcomprises a selection of one or more of the service parallelizationoptions.

Clause 71. The method as recited in any of clauses 65 to 70, wherein theplurality of configuration options comprise a plurality of responseprecomputation options, and wherein the optimized configurationcomprises a selection of one or more of the response precomputationoptions.

Clause 72. The method as recited in any of clauses 65 to 71, wherein theoptimized configuration comprises a new location for a service withrespect to a data source that provides input for the service.

Clause 73. A computer-readable storage medium storing programinstructions computer-executable to perform:

-   -   collecting trace data for a plurality of service interactions        between individual ones of a plurality of services in a        service-oriented system;    -   determining a respective cost of individual ones of a plurality        of configuration options in the service-oriented system;    -   determining an optimized configuration for the service-oriented        system based on the respective costs and the trace data, wherein        the optimized configuration is determined using an automated        optimizer, and wherein the optimized configuration comprises a        selection of one or more of the plurality of configuration        options; and    -   causing deployment of the optimized configuration to the        service-oriented system.

Clause 74. The computer-readable storage medium as recited in clause 73,wherein the plurality of configuration options comprise a plurality ofcache configuration options, and wherein the optimized configurationcomprises a selection of one or more of the cache configuration options.

Clause 75. The computer-readable storage medium as recited in clause 73or 74, wherein the deployment of the optimized configuration comprisesmodification of a configuration of a cache or a location of a datasource for a service whose program code does not specify usage of thecache or the data source.

Clause 76. The computer-readable storage medium as recited in any ofclauses 73 to 75, wherein the program instructions are furthercomputer-executable to perform:

-   -   refining the optimized configuration for the service-oriented        system a plurality of times over an interval of time.

Clause 77. The computer-readable storage medium as recited in any ofclauses 73 to 76, wherein the plurality of configuration optionscomprise a plurality of data location options, and wherein the optimizedconfiguration comprises a selection of one or more of the data locationoptions.

Clause 78. The computer-readable storage medium as recited in any ofclauses 73 to 77, wherein the plurality of configuration optionscomprise a plurality of service parallelization options, and wherein theoptimized configuration comprises a selection of one or more of theservice parallelization options.

Clause 79. The computer-readable storage medium as recited in any ofclauses 73 to 78, wherein the plurality of configuration optionscomprise a plurality of response precomputation options, and wherein theoptimized configuration comprises a selection of one or more of theresponse precomputation options.

Clause 80. The computer-readable storage medium as recited in any ofclauses 73 to 79, wherein the optimized configuration improves at leastone performance metric, at least one cost, or at least one performancemetric and at least one cost across at least a portion of theservice-oriented system.

Clause 81. A system, comprising:

-   -   a plurality of computing devices configured to implement an        optimization system and a service-oriented system, wherein the        service-oriented system comprises a plurality of services,        wherein the optimization system is configured to:        -   perform a cross-service static analysis of program code for            individual ones of the plurality of services;        -   determine, based on the cross-service static analysis, one            or more service dependencies in the program code for the            individual ones of the plurality of services, wherein the            one or more service dependencies comprise one or more            service calls between the individual ones of the plurality            of services;        -   determine an optimized configuration for the            service-oriented system, wherein the optimized configuration            improves a total performance metric in at least a portion of            the service-oriented system, and wherein the optimized            configuration comprises a colocation of at least two of the            plurality of services based on the one or more service            dependencies; and        -   cause deployment of individual ones of the plurality of            services based on the optimized configuration, wherein the            deployment comprises the colocation.

Clause 82. The system as recited in clause 81, wherein the optimizationsystem is configured to:

-   -   generate, based on the cross-service static analysis, program        code for one or more new services, wherein the program code for        the one or more new services comprises at least a portion of the        program code for two or more of the plurality of services.

Clause 83. The system as recited in clause 81 or 82, wherein theoptimization system is configured to:

-   -   compile the program code for two or more of the services        together based on the one or more service dependencies.

Clause 84. The system as recited in any of clauses 81 to 83, wherein, in

-   -   causing deployment of individual ones of the plurality of        services based on the optimized configuration, the optimization        system is configured to:    -   cause deployment of two or more of the services to a same zone        based on the one or more service dependencies;    -   cause deployment of two or more of the services to a same host        based on the one or more service dependencies; or    -   cause deployment of two or more of the services to a same        process based on the one or more service dependencies.

Clause 85. A computer-implemented method, comprising:

-   -   performing a cross-service static analysis of program code for        individual ones of a plurality of services in a service-oriented        system;    -   determining, based on the cross-service static analysis, one or        more service dependencies in the program code for the individual        ones of the plurality of services;    -   determining an optimized configuration for the service-oriented        system based on the one or more service dependencies; and    -   causing deployment of individual ones of the plurality of        services to the service-oriented system based on the optimized        configuration.

Clause 86. The method as recited in clause 85, wherein causingdeployment of the individual ones of the plurality of services to theservice-oriented system based on the optimized configuration comprises:

-   -   causing deployment of two or more of the services to a same zone        based on the one or more service dependencies.

Clause 87. The method as recited in clause 85 or 86, wherein causingdeployment of the individual ones of the plurality of services to theservice-oriented system based on the optimized configuration comprises:

-   -   causing deployment of two or more of the services to a same host        based on the one or more service dependencies.

Clause 88. The method as recited in any of clauses 85 to 87, whereincausing deployment of the individual ones of the plurality of servicesto the service-oriented system based on the optimized configurationcomprises:

-   -   causing deployment of two or more of the services to a same        process based on the one or more service dependencies.

Clause 89. The method as recited in any of clauses 85 to 88, furthercomprising:

-   -   generating, based on the cross-service static analysis,        optimized program code for one or more of the plurality of        services.

Clause 90. The method as recited in any of clauses 85 to 89, furthercomprising:

-   -   generating, based on the cross-service static analysis, program        code for one or more new services, wherein the program code for        the one or more new services comprises at least a portion of the        program code for two or more of the plurality of services and        excludes an additional portion of the program code for the two        or more of the plurality of services.

Clause 91. The method as recited in any of clauses 85 to 90, furthercomprising:

-   -   collecting trace data using individual ones of the deployed        services, wherein the trace data describes a plurality of        service interactions; and    -   refining the optimized configuration using the trace data.

Clause 92. The method as recited in any of clauses 85 to 91, furthercomprising:

-   -   deploying, based on the cross-service static analysis, one or        more caches between individual ones of the plurality of        services.

Clause 93. A computer-readable storage medium storing programinstructions computer-executable to perform:

-   -   performing a cross-service static analysis of program code for        individual ones of a plurality of services in a service-oriented        system;    -   determining, based on the cross-service static analysis, one or        more service dependencies in the program code for the individual        ones of the plurality of services, wherein the one or more        service dependencies comprise one or more service calls between        the individual ones of the plurality of services;    -   determining an optimized configuration for the service-oriented        system based on the one or more service dependencies, wherein        the optimized configuration improves a total performance metric        in at least a portion of the service-oriented system; and    -   causing deployment of individual ones of the plurality of        services to the service-oriented system based on the optimized        configuration.

Clause 94. The computer-readable storage medium as recited in clause 93,wherein, in causing deployment of the individual ones of the pluralityof services to the service-oriented system based on the optimizedconfiguration, the program instructions are further computer-executableto perform:

-   -   causing deployment of two or more of the services to a same zone        based on the one or more service dependencies.

Clause 95. The computer-readable storage medium as recited in clause 93or 94, wherein, in causing deployment of the individual ones of theplurality of services to the service-oriented system based on theoptimized configuration, the program instructions are furthercomputer-executable to perform:

-   -   causing deployment of two or more of the services to a same host        based on the one or more service dependencies.

Clause 96. The computer-readable storage medium as recited in any ofclauses 93 to 95, wherein, in causing deployment of the individual onesof the plurality of services to the service-oriented system based on theoptimized configuration, the program instructions are furthercomputer-executable to perform:

-   -   causing deployment of two or more of the services to a same        process based on the one or more service dependencies.

Clause 97. The computer-readable storage medium as recited in any ofclauses 93 to 96, wherein the program instructions are furthercomputer-executable to perform:

-   -   generating, based on the cross-service static analysis,        optimized program code for one or more of the plurality of        services.

Clause 98. The computer-readable storage medium as recited in any ofclauses 93 to 97, wherein the program instructions are furthercomputer-executable to perform:

-   -   generating, based on the cross-service static analysis, program        code for one or more new services, wherein the program code for        the one or more new services comprises at least a portion of the        program code for two or more of the plurality of services and        excludes an additional portion of the program code for the two        or more of the plurality of services.

Clause 99. The computer-readable storage medium as recited in any ofclauses 93 to 98, wherein the program instructions are furthercomputer-executable to perform:

-   -   generating, based on the cross-service static analysis,        optimized program code for one or more of the plurality of        services, wherein the optimized program code substitutes a table        of results for a service call, wherein contents of the table of        results are restricted based on the cross-service static        analysis.

Clause 100. The computer-readable storage medium as recited in any ofclauses 93 to 99, wherein the program instructions are furthercomputer-executable to perform:

-   -   deploying, based on the cross-service static analysis, one or        more caches between individual ones of the plurality of        services.

Various embodiments may further include receiving, sending, or storinginstructions and/or data implemented in accordance with the foregoingdescription upon a computer-readable medium. Generally speaking, acomputer-readable medium may include storage media or memory media suchas magnetic or optical media, e.g., disk or DVD/CD-ROM, volatile ornon-volatile media such as RAM (e.g. SDRAM, DDR, RDRAM, SRAM, etc.),ROM, etc. In some embodiments, a computer-readable medium may alsoinclude transmission media or signals such as electrical,electromagnetic, or digital signals, conveyed via a communication mediumsuch as network and/or a wireless link.

The various methods as illustrated in the Figures and described hereinrepresent exemplary embodiments of methods. The methods may beimplemented in software, hardware, or a combination thereof. In variousof the methods, the order of the steps may be changed, and variouselements may be added, reordered, combined, omitted, modified, etc.Various ones of the steps may be performed automatically (e.g., withoutbeing directly prompted by user input) and/or programmatically (e.g.,according to program instructions).

The terminology used in the description of the invention herein is forthe purpose of describing particular embodiments only and is notintended to be limiting of the invention. As used in the description ofthe invention and the appended claims, the singular forms “a”, “an” and“the” are intended to include the plural forms as well, unless thecontext clearly indicates otherwise. It will also be understood that theterm “and/or” as used herein refers to and encompasses any and allpossible combinations of one or more of the associated listed items. Itwill be further understood that the terms “includes,” “including,”“comprises,” and/or “comprising,” when used in this specification,specify the presence of stated features, integers, steps, operations,elements, and/or components, but do not preclude the presence oraddition of one or more other features, integers, steps, operations,elements, components, and/or groups thereof.

As used herein, the term “if” may be construed to mean “when” or “upon”or “in response to determining” or “in response to detecting,” dependingon the context. Similarly, the phrase “if it is determined” or “if [astated condition or event] is detected” may be construed to mean “upondetermining” or “in response to determining” or “upon detecting [thestated condition or event]” or “in response to detecting [the statedcondition or event],” depending on the context.

It will also be understood that, although the terms first, second, etc.,may be used herein to describe various elements, these elements shouldnot be limited by these terms. These terms are only used to distinguishone element from another. For example, a first contact could be termed asecond contact, and, similarly, a second contact could be termed a firstcontact, without departing from the scope of the present invention. Thefirst contact and the second contact are both contacts, but they are notthe same contact.

Numerous specific details are set forth herein to provide a thoroughunderstanding of claimed subject matter. However, it will be understoodby those skilled in the art that claimed subject matter may be practicedwithout these specific details. In other instances, methods, apparatus,or systems that would be known by one of ordinary skill have not beendescribed in detail so as not to obscure claimed subject matter. Variousmodifications and changes may be made as would be obvious to a personskilled in the art having the benefit of this disclosure. It is intendedto embrace all such modifications and changes and, accordingly, theabove description is to be regarded in an illustrative rather than arestrictive sense.

What is claimed is:
 1. A system, comprising: a plurality of computingdevices configured to implement an optimization system and aservice-oriented system, wherein the service-oriented system comprises aplurality of services, wherein the plurality of services are configuredto: generate trace data indicating relationships between individual onesof the plurality of services based on a plurality of serviceinteractions between the individual ones of the plurality of services,wherein the trace data comprises data indicative of network latency foreach of the plurality of service interactions; and send the trace datato the optimization system; and wherein the optimization system isconfigured to: determine one or more performance metrics for theplurality of service interactions based on the trace data; determine anoptimized configuration for the service-oriented system based on the oneor more performance metrics; and cause relocation of one or more of theplurality of services to one or more edge hosts based on the optimizedconfiguration, wherein the relocation improves a total performancemetric for one or more service interactions involving the one or morerelocated services on the one or more edge hosts.
 2. The system asrecited in claim 1, wherein the optimization system is configured to:cause an additional relocation of one or more of the plurality ofservices to one or more of the client devices based on the optimizedconfiguration, wherein the additional relocation improves a totalperformance metric for one or more service interactions involving theone or more client devices.
 3. The system as recited in claim 1, whereinthe optimization system is configured to: generate a partial servicebased on an original service of the plurality of services, wherein thepartial service includes a first set of program code from the originalservice and excludes a second set of program code from the originalservice, and wherein the first set of program code is included in thepartial service based on a frequency of use of the first set of programcode; wherein, in causing the relocation of one or more of the pluralityof services to the one or more edge hosts based on the optimizedconfiguration, the optimization system is configured to cause relocationof the partial service to the one or more edge hosts based on theoptimized configuration.
 4. The system as recited in claim 1, whereinone or more content delivery networks comprise the one or more edgehosts.
 5. A computer-implemented method, comprising: determining one ormore performance metrics for a plurality of service interactions basedon trace data indicating relationships between individual ones of theplurality of services based on a plurality of service interactionsbetween the individual ones of the plurality of services in aservice-oriented system, wherein the trace data comprises dataindicative of network latency for the plurality of service interactions;determining an optimized configuration for the service-oriented systembased on the one or more performance metrics; and causing relocation ofone or more of the plurality of services to or from one or more edgehosts based on the optimized configuration, wherein the relocationimproves a total performance metric for one or more service interactionsof the plurality of service interactions involving the one or more edgehosts.
 6. The method as recited in claim 5, further comprising: causingan additional relocation of one or more of the plurality of services toor from one or more of the client devices based on the optimizedconfiguration, wherein the additional relocation improves a totalperformance metric for one or more service interactions involving theone or more client devices.
 7. The method as recited in claim 5, furthercomprising: generating a partial service based on an original service ofthe plurality of services, wherein the partial service includes a firstset of program code from the original service and excludes a second setof program code from the original service, and wherein the first set ofprogram code is included in the partial service based on a frequency ofuse of the first set of program code; wherein causing the relocation ofone or more of the plurality of services to or from the one or more edgehosts based on the optimized configuration comprises causing relocationof the partial service to or from the one or more edge hosts based onthe optimized configuration.
 8. The method as recited in claim 5,wherein one or more content delivery networks comprise the one or moreedge hosts.
 9. The method as recited in claim 5, further comprising:determining a further optimized configuration for the service-orientedsystem based on additional trace data for a plurality of additionalservice interactions in the service-oriented system; and causing anadditional relocation of individual ones of the relocated one or moreservices from the one or more edge hosts to one or more hosts in theservice-oriented system, wherein the additional relocation is performedbased on the further optimized configuration.
 10. The method as recitedin claim 5, further comprising: translating program code for therelocated one or more services to a format executable on the one or moreedge hosts.
 11. The method as recited in claim 5, wherein the optimizedconfiguration is determined based on an estimated cost of executing therelocated one or more services on the one or more edge hosts.
 12. Themethod as recited in claim 5, wherein the optimized configuration isdetermined based on a security risk analysis of executing the relocatedone or more services on the one or more edge hosts.
 13. A non-transitorycomputer-readable storage medium storing program instructions that, whenexecuted on one or more processors, cause the one or more processors toperform: collecting trace data indicating relationships betweenindividual ones of a plurality of services based on a plurality ofservice interactions between the individual ones of the plurality ofservices in a service-oriented system, wherein the trace data comprisesdata indicative of network latency for the plurality of serviceinteractions; determining one or more performance metrics for theplurality of service interactions based on the trace data; determiningan optimized configuration for the service-oriented system based on theone or more performance metrics; and causing relocation of one or moreof the plurality of services to one or more edge hosts based on theoptimized configuration, wherein the relocation improves a totalperformance metric for one or more service interactions of the pluralityof service interactions involving the one or more edge hosts.
 14. Thenon-transitory computer-readable storage medium as recited in claim 13,wherein the program instructions when executed further cause the one ormore processors to perform: causing an additional relocation of one ormore of the plurality of services to one or more of the client devicesbased on the optimized configuration, wherein the additional relocationimproves a total performance metric for one or more service interactionsinvolving the one or more client devices.
 15. The non-transitorycomputer-readable storage medium as recited in claim 13, wherein theprogram instructions when executed further cause the one or moreprocessors to perform: generating a partial service based on an originalservice of the plurality of services, wherein the partial serviceincludes a first set of program code from the original service andexcludes a second set of program code from the original service, andwherein the first set of program code is included in the partial servicebased on a frequency of use of the first set of program code; whereincausing the relocation of one or more of the plurality of services tothe one or more edge hosts based on the optimized configurationcomprises causing relocation of the partial service to the one or moreedge hosts based on the optimized configuration.
 16. The non-transitorycomputer-readable storage medium as recited in claim 13, wherein one ormore content delivery networks comprise the one or more edge hosts. 17.The non-transitory computer-readable storage medium as recited in claim13, wherein the optimized configuration is determined based on asecurity risk analysis of executing the relocated one or more serviceson the one or more edge hosts.
 18. The non-transitory computer-readablestorage medium as recited in claim 13, wherein the program instructionswhen executed further cause the one or more processors to perform:translating program code for the relocated one or more services to aformat executable on the one or more edge hosts.
 19. The non-transitorycomputer-readable storage medium as recited in claim 13, wherein theoptimized configuration is determined based on an estimated cost ofexecuting the relocated one or more services on the one or more edgehosts.
 20. The non-transitory computer-readable storage medium asrecited in claim 13, wherein the program instructions when executedfurther cause the one or more processors to perform: determining afurther optimized configuration for the service-oriented system based onadditional trace data for a plurality of additional service interactionsin the service-oriented system; and causing an additional relocation ofindividual ones of the relocated one or more services from the one ormore edge hosts to one or more hosts in the service-oriented system,wherein the additional relocation is performed based on the furtheroptimized configuration.